Thursday, May 9, 2013

Some Interview Questions

1.  Describe OOPS Concepts
2.  How does we can achieve abstraction?
3.  What is static and final?
4.  Where does static variables stored in memory?
5.  What is week reference and strong reference?
      Week Reference -->week reference is a reference that does not protect the referenced object from collection by garbage collector.
   
6.  What does Garbage Collector in JAVA?
7.  Where does synchronize comes into picture?
8.  Activity Life Cycle
9.  Explain about Fragments, how do you manage Fragments& Can we have fragments for lower versions
10.Explain about Content Provider, Can we use directly SQL query for content provider.
11.What is Intent Service? and What is Bind method?
12.How many process will create for application and can we have multiple process?
13.How we restrict our application to be installed only on tablets?
14.What is AsyncTask? Does AsyncTask used only for downloading any thing?
15.Why can't we use Threads instead of AsyncTask?
16.What is publish progress?
17.What all are thing we need to take care when our application supposed to support multiple devices?
18.Did you use Webservices?
19.Difference between SAX and DOM Parsers?
20.Did you use JSON and how to get the data from JSON?
21.Did you create any custom component?
22.How to take care of Memory Managment?
----------------------------------------------------
Some more Questions
1.  What is Android Architecture?
2.  What is Client-Server Architecture?
3.  What is Manifest file and what is meta-data

Wednesday, May 8, 2013

Difference between Android Service,Thread,IntentService and AsyncTask




Service
Thread
IntentService
AsyncTask
When to use ?
Task with no UI, but shouldn't be too long. Use threads within service for long tasks.
- Long task in general.

- For tasks in parallel use Multiple threads (traditional mechanisms)
- Long task usually with no communication to main thread.
(Update)- If communication is required, can use main thread handler or broadcast intents

- When callbacks are needed (Intent triggered tasks). 
- Small task having to communicate with main thread.

- For tasks in parallel use multiple instances OR Executor
 
Trigger
Call to method
onStartService()
Thread start() method
Intent
Call to method execute()
Triggered From (thread)
Any thread
Any Thread
Main Thread (Intent is received on main thread and then worker thread is spawed)
Main Thread
Runs On (thread)
Main Thread
Its own thread
Separate worker thread
Worker thread. However, Main thread methods may be invoked in between to publish progress.
Limitations /
Drawbacks
May block main thread
- Manual thread management

- Code may become difficult to read
- Cannot run tasks in parallel.

- Multiple intents are queued on the same worker thread.
- one instance can only be executed once (hence cannot run in a loop) 

- Must be created and executed from the Main thread

                                                                                                 Reference-crazyaboutandroid-Blog