RSS

FAQ

Achievements in company:
1. Work in pressure situation
2. Learn android technology
3. Deployment process of android app to play store
4. Interact with clients
5. New layout design presentation of android app
6. Assign tasks to the team members
7. Project setup (SVN)

Deployment stuffs required for play store:
1. Title
2. Description
3. Screenshots
4. High-res icon
5. Application type
6. category
7. content rating
8. Email

Android:
1. Android is a stack of software for mobile devices which has Operating System, middleware and some key applications.
2. The application executes within its own process and its own instance of Dalvik Virtual Machine.

Dalvik Virtual Machine:
1. which is a kind of Java Virtual Machine specially designed and optimized for Android.
2. Java source code is converted into .class file which is then converted into .dex file (Delvik executable File) using dx tool in android SDK.
3. The Dalvik VM enables every Android application to run in its own process, with its own instance of the Dalvik virtual machine.

Android Activities/Android Application Lifecycle:

onCreate(): This is the first callback and called when the activity is first created.

onStart(): This callback is called when the activity becomes visible to the user.

onResume(): This is called when the user starts interacting with the application.

onPause(): The paused activity does not receive user input and cannot execute any code and called when the current activity is being paused and the previous activity is being resumed.

onStop(): This callback is called when the activity is no longer visible.

onDestroy(): This callback is called before the activity is destroyed by the system.

onRestart(): This callback is called when the activity restarts after stopping it.

Example:
Real time scenario Case 1:
App runs for the first time onCreate()
onStart()
onResume()

Case 2:
Activity visible to user and he click on Home key
onPause()
onStop()

Case 3:
User tries to enter into app by click on app launcher icon
onRestart()
onStart()
onResume()

Case 4:
Back press after Activity loads
onPause()
onStop()
onDestory()

Case 5:
Load Activity from memory (Recent apps from memory)
onRestart()
onStart()
onResume()

Content Provider:
1. supplies data from one application to others on request.
2. Such requests are handled by the methods of the ContentResolver class.
3. A content provider can use different ways to store its data and the data can be stored in a database, in files, or even over a network.

Here is the list of methods which you need to override in Content Provider class to have your Content Provider working:

onCreate() This method is called when the provider is started.

query() This method receives a request from a client. The result is returned as a Cursor object.

insert()This method inserts a new record into the content provider.

delete() This method deletes an existing record from the content provider.

update() This method updates an existing record from the content provider.

getType() This method returns the MIME type of the data at the given URI.

Example:
Fetch details of user from Contact Book

Fragment:
– fragment is a kind of sub-acitivity.
Following are important points about fragment:
1. A fragment has its own layout and its own behavior with its own lifecycle callbacks.
2. You can add or remove fragments in an activity while the activity is running.
3. You can combine multiple fragments in a single activity to build a multi-pane UI.
4. A fragment can be used in multiple activities.
5. A fragment can implement a behavior that has no user interface component.
6. Fragments were added to the Android API in Honeycomb version 11.
Thread:
1. thread is a sequential path of code execution within a program
2. is a lightweight process which exist within a program and executed to perform a special
task.

Two types of threads:
1. Synchronized Threads
2. Asynchronous Threads

Asynchronous Threads:
1. In Java, the threads are executed independently to each other. These types of threads are
called as asynchronous threads.
2. Two or more threads share the same resource (variable or method) while only one of them
can access the resource at one time.

Suppose, we have created two methods as increment( ) and decrement( ). which increases or
decreases value of the variable “count” by 1 respectively shown as:
public void increment( ) {
count++;
}

public void decrement( ) {
count–;
}
public int value() {
return count;
}

3. When the two threads are executed to access these methods (one for increment( ),another
for decrement( )) then both will share the variable “count”. in that case, we can’t be sure that
what value will be returned of variable “count”.

To avoid this problem keyword synchronized came into picture

Synchronized Threads:
1. it is used to ensure that only one thread is in a critical region.
2. Once the thread is in its critical section, no other thread can enter to that critical region. In
that case, another thread will has to wait until the current thread leaves its critical section.
synchronized(object) {

// statements to be synchronized

}

Difference between Thread and Runnable interface in Java

1. Java doesn’t support multiple inheritance, which means you can only extend one class in
Java so once you extended Thread class you lost your chance and can not extend or
inherit another class in Java.
2. You can create and run a thread in either ways; Extending Thread class, Implementing
Runnable interface.
3. the significant difference is:
a. When you extends Thread class, each of your thread creates unique object and
associate with it.
b. When you implements Runnable, it shares the same object to multiple threads.
Example:

class ImplementsRunnable implements Runnable {

private int counter 0;

public void run() {
counter++;
System.out.println(“ImplementsRunnable : Counter : ” + counter);
}
}

class ExtendsThread extends Thread {

private int counter 0;

public void run() {
counter++;
System.out.println(“ExtendsThread : Counter : ” + counter);
}
}

public class ThreadVsRunnable {

public static void main(String args[]) throws Exception {
//Multiple threads share the same object.
ImplementsRunnable rc new ImplementsRunnable();
Thread t1 new Thread(rc);
t1.start();
Thread.sleep(1000); // Waiting for 1 second before starting next thread
Thread t2 new Thread(rc);
t2.start();
Thread.sleep(1000); // Waiting for 1 second before starting next thread
Thread t3 new Thread(rc);
t3.start();

//Creating new instance for every thread access.
ExtendsThread tc1 new ExtendsThread();
tc1.start();
Thread.sleep(1000); // Waiting for 1 second before starting next thread
ExtendsThread tc2 new ExtendsThread();
tc2.start();
Thread.sleep(1000); // Waiting for 1 second before starting next thread
ExtendsThread tc3 new ExtendsThread();
tc3.start();
}
}

Output:
ImplementsRunnable : Counter : 1
ImplementsRunnable : Counter : 2
ImplementsRunnable : Counter : 3
ExtendsThread : Counter : 1
ExtendsThread : Counter : 1
ExtendsThread : Counter : 1

Explaination:
In the Runnable interface approach, only one instance of a class is being created and it has been
shared by different threads. So the value of counter is incremented for each and every thread
access.

Whereas, Thread class approach, you must have to create separate instance for every thread
access. Hence different memory is allocated for every class instances and each has separate
counter, the value remains same, which means no increment will happen because none of the
object reference is same.

When to use Runnable?
Use Runnable interface when you want to access the same resource from the group of threads.
Avoid using Thread class here, because multiple objects creation consumes more memory and it
becomes a big performance overhead.

Which one is best to use?
Ans : Very simple, based on your application requirements you will use this appropriately. But I
would suggest, try to use interface inheritance i.e., implements Runnable.

Ref:
http://manikandanmv.wordpress.com/tag/difference-between-thread-and
-runnable/

Access Modifiers:

Access Modifiers Same Class Same Package Subclass Other packages
public Y Y Y Y
protected Y Y Y N
no access modifier Y Y N N
private Y N N N

– A member declared with ‘public’ access modifier CAN be accessed by the members of the ‘same class’.

Android device screen resolutions:
1. QVGA (240×320)
2. HVGA (320X480)
3. WVGA (480×800)
4. qHD (540×960)
5. HD (1280×720)
6. FHD (1920×1080)
7. WXGA (1280×800)
8. WQXGA (2560×1600)

Types of Animation:

In Android we can use two types of Animation
1. Tween Animation
2. Frame Animation

Tween Animation:
Four types of predefined tween animation are used in Android.
1. Alpha Animation – In this animation we can change the view transparency causes a fading
in fading out effect.
2. Scale Animation – scale animation allows us to zoom into or out from the selected view
that means we can change view size.
3. Rotate Animation – We spin the selected view in the XY plane and we can change the
position.In this view rotates smoothly.
4. Translate Animation – We move the selected view around the screen.We can also change
its position.

Frame Animation:
used for complicated transformation

Ref:
http://sawankumar46.blogspot.in/2012/10/animation.html

Difference between android:minSdkVersion || android:targetSdkVersion || android:maxSdkVersion

android:minSdkVersion 
1. The Android system will prevent the user from installing the application if the system’s API
Level is lower than the value specified in this attribute.
2. Google Play filter apps for the user based on their device

android:targetSdkVersion
1. If not set, the default value equals that given to minSdkVersion.
2. If the API level of the platform is higher than the version declared for targetSdkVersion the
system may enable compatibility behaviors to ensure that your app continues to work the
way you expect.
3. Example: Style of opening context menu varies in ICS and below

android:maxSdkVersion
Example:
An application declaring maxSdkVersion “5” in its manifest is published on Google Play. A user
whose device is running Android 1.6 (API Level 4) downloads and installs the app. After a few
weeks, the user receives an over-the-air system update to Android 2.0 (API Level 5). After the
update is installed, the system checks the application’s maxSdkVersion and successfully
re-validates it. The application functions as normal. However, some time later, the device receives
another system update, this time to Android 2.0.1 (API Level 6). After the update, the system can
no longer re-validate the application because the system’s own API Level (6) is now higher than
the maximum supported by the application (5). The system prevents the application from being
visible to the user, in effect removing it from the device.

Button || ImageButton || ImageView

– ImageView Display Images (android:src)

– ImageButton Display Images as imageView and get click effect as button (android:src) and
cannot set text to it.

– Button set text and (android:background)

When to use ImageButton rather than ImageView?
There’s no differences, except default style. ImageButton has a non-null background by default.

How to get rid of outofmemoryexception while loading image in android?
While decoding the bitmap pass bitmap option as inSampleSize = 4.
Example:

BitmapFactory.Options options = new BitmapFactory.Options();
options.inSampleSize = 4;
bitmap = BitmapFactory.decodeFile(data,options);

inSampleSize:
1. Requests the decoder to subsample the original image, returning a smaller image to save memory.
2. For example, inSampleSize == 4 returns an image that is 1/4 the width/height of the original

What is Determining an android APK format?
APK file is compressed AndroidManifest.xml file with the extension. Apk. Resource files, the application code and many other files in this format and compressed into a single file with a. Apk.

Explain about the exceptions of Android?
The following are the exceptions that are supported by Android
1. InflateException: When an error conditions are occurred, this exception is thrown
2. Surface.OutOfResourceException: When a surface is not created or resized, this exception is thrown
3. SurfaceHolder.BadSurfaceTypeException: This exception is thrown from the lockCanvas() method, when invoked on a Surface whose is SURFACE_TYPE_PUSH_BUFFERS
4. WindowManager.BadTokenException: This exception is thrown at the time of trying to add view an invalid WindowManager.LayoutParamstoken.

What is an Application ?
A collection of one or more activities, services, listeners, and intent receivers. An application has a single manifest, and is compiled into a single .apk file on the device.

Describe a real time scenario where android can be used?
Imagine a situation that you are in a country where no one understands the language you speak and you can not read or write. However, you have mobile phone with you.
With a mobile phone with android, the Google translator translates the data of one language into another language by using XMPP to transmit data. You can type the message in English and select the language which is understood by the citizens of the country in order to reach the message to the citizens.

static || final static:
1. static means that something is associated with a class and not an object of that class.
2. static methods, members can be called without creating object of the class.
3. you can change the value of static variable dynamically.
final:
1. final variables are constants and cannot be changed.
2. final class cannot be changed.
3. you cannot change the value of variable dynamically if that is declared as final.

Abstract class Interface
1. Abstract class contains one or more abstract       methods 1. All methods in the interface are abstract
2. use abstract keyword to define 2. use interface keyword to define
3. Abstract class contains private, public or      protected members 3. interface can only have public members
4. Comparatively faster than interfaces 4. Interfaces are slow as it requires extra       indirection to find corresponding method in     actual class

Pull Parser:
1. Allows you to pull events in a loop and handle the ones you care about.
2. Easier to use than SAX parser 3. Little slower

SAX DOM
1. Parse node by node 1. Stores entire xml document into the memory       before processing
2. Doesn’t store xml in memory 2. Occupies more memory
3.We cannot insert or delete a node 3. We can insert or delete nodes
4. Top to Bottom traversing 4. Travers in any direction

Agile Project methodology:
1. Entire team should be a tightly integrated unit.
2. This includes the developers, quality assurance, project management, and the customer.
3. Frequent communication is one of the key factors that make this integration possible. Therefore, daily meetings are held in order to determine the day’s work and dependencies.
4. Deliveries are short-term. Usually a delivery cycle ranges from one week to four weeks. These are commonly known as sprints.

XML Parsing using DOM:
(Ref: http://www.androidhive.info/2011/11/android-xml-parsing-tutorial/)
Follow steps below for parsing
1. Getting XML content by making HTTP Request
2. Parsing XML content and getting DOM element
3. By using getElementsByTagName fetch the NodeList
4. Loop through all the item nodes
5. Get each xml child element value by passing element node name

BaseAdapter || ArrayAdapter || ListAdapter:
1. Base Adapter as the name suggests, is a base class for all the adapters.
2. When you are extending the Base adapter class you need to implement all the methods like getcount,getid etc.
3. ArrayAdapter is a class which can work with array of data. you need to override only getview method
4. Listadapter is a an interface implemented by concrete adapter classes.
5. Base adapter is abstract class where as array adapter and the list adapter are the concrete classes.
6. Array adapter and listadapter classes are developed since in general we deal with the array data sets and list data sets.

Abstract and Concrete Classes:
All classes can be designated as either abstract or concrete. Concrete is the default. This means that the class can have (direct) instances. In contrast, abstract means that a class cannot have its own (direct) instances.

Inheritance:
1. Inheritance is a mechanism in which one object acquires all the properties and behaviours of parent object.
2. The idea behind inheritance is that you can create new classes that are built upon existing classes. When you inherit from an existing class, you reuse (or inherit) methods and fields, and you add new methods and fields to adapt your new class to new situations.Inheritance represents the IS-A relationship.
3. With the help of inheritance the information is made manageable in a hierarchical order
1.1 Why use Inheritance?
1. For Method Overriding (So Runtime Polymorphism).
2. For Code Reusability.
Example: class Employee{
int salary=40000;
}
class Programmer extends Employee{
int bonus=10000; Public Static void main(String args[]){ Programmer p=new Programmer(); System.out.println(“Programmer salary is:”+p.salary); System.out.println(“Bonus of Programmer is:”+p.bonus); } } Output: Programmer salary is:40000 Bonus of programmer is:10000
In the above example,Programmer object can access the field of own class as well as of Employee class i.e. code reusability.

Advertisements
 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: