Showing posts with label Android. Show all posts
Showing posts with label Android. Show all posts

Monday, 11 January 2016

Diffrence between Service and Intentservice in Android?

Below are some key differences between Service and IntentService.

When to use?

The Service can be used in tasks with no UI, but shouldn't be too long. If you need to perform long tasks, you must use threads within Service.

The IntentService can be used in long tasks usually with no communication to Main Thread. If communication is required, can use Main Thread handler or broadcast intents. Another case of use is when callbacks are needed (Intent triggered tasks).

How to trigger?

The Service is triggered by calling method startService().

The IntentService is triggered using an Intent, it spawns a new worker thread and the method onHandleIntent() is called on this thread.

Triggered From

The Service and IntentService may be triggered from any thread, activity or other application component.
Runs On

The Service runs in background but it runs on the Main Thread of the application.

The IntentService runs on a separate worker thread.

Limitations / Drawbacks

The Service may block the Main Thread of the application.

The IntentService cannot run tasks in parallel. Hence all the consecutive intents will go into the message queue for the worker thread and will execute sequentially.

When to stop?

If you implement a Service, it is your responsibility to stop the service when its work is done, by calling stopSelf() or stopService(). (If you only want to provide binding, you don't need to implement this method).

The IntentService stops the service after all start requests have been handled, so you never have to call stopSelf().

Friday, 8 January 2016

Saturday, 22 August 2015

Is it okay to change the name of an application after its deployment?

How can two Android applications share same Linux user ID and share same VM?

When does Android start and end an application process?

How does an application run in isolation from other applications?

How does Android system track the applications?

What are Dalvik Executable files?

Can you deploy executable JARs on Android?

Why cannot you run standard Java bytecode on Android?

What is the difference between a fragment and an activity? 

What is DDMS? Describe some of its capabilities.

What is ADB?

ADB stands for Android Debug Bridge. It is a command line tool that is used to communicate with the emulator instance.

Android Debug Bridge (adb) is a versatile command line tool that lets you communicate with an emulator instance or connected Android-powered device. It is a client-server program that includes three components:


  • A client, which runs on your development machine. You can invoke a client from a shell by issuing an adb command. Other Android tools such as the ADT plugin and DDMS also create adb clients.
  • A server, which runs as a background process on your development machine. The server manages communication between the client and the adb daemon running on an emulator or device.
  • A daemon, which runs as a background process on each emulator or device instance.

What is ANR?

ANR stands for Application Not Responding. It is a dialog box that appears if the application is no longer responding.


Friday, 21 August 2015

What are the code names of Android?


  1. Aestro
  2. Blender
  3. Cupcake
  4. Donut
  5. Eclair
  6. Froyo
  7. Gingerbread
  8. Honycomb
  9. Ice Cream Sandwitch
  10. Jelly Bean
  11. Kitkat
  12. Lollipop


Does android support other language than java?

Yes, android app can be developed in C/C++ also using android NDK (Native Development Kit). It makes the performance faster. It should be used with android SDK.



More details read discussion at:
http://stackoverflow.com/questions/1994703/which-programming-languages-can-i-use-on-android-dalvik

What are the life cycle methods of android activity?

There are 7 life-cycle methods of activity. They are as follows:

onCreate()
onStart()
onResume()
onPause()
onStop()
onRestart()
onDestroy()


  1. onCreate() This is the first callback and called when the activity is first created.
  2. onStart()         This callback is called when the activity becomes visible to the user.
  3. onResume() This is called when the user starts interacting with the application.
  4. 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.
  5. onStop() This callback is called when the activity is no longer visible.
  6. onDestroy() This callback is called before the activity is destroyed by the system.
  7. onRestart() This callback is called when the activity restarts after stopping it.




What are the core building blocks of android?

The core building blocks of android are:


  • Activity
  • View
  • Intent
  • Service
  • Content Provider
  • Fragment