Posts

Showing posts from May, 2018

What are Support Libraries ?

Image
Android regularly releases Support Libraries , which are a bunch of features . Why Support Libraries ? Android keeps on adding new features. Say you have an App which was created using an older API version and you want to add the new features, you can do so using the Support libraries. So the purpose of these Libraries is to let Apps use new features of Android. What does the number attached to Support Library indicate ? Let’s take the v4 support library as an example. Now the number 4 in this indicates that this can be added to Apps which have been created with an API level greater than 4. Example v4 support library – Includes largest set of features. v7 appcompat library – Support for Action Bars. Can be included with API level 7 and above. In the next lesson you will create a new Project “ThemeDemoApp” to get better understanding of these concepts. Android Documentation –  http://developer.android.com/tools/support-library/index.html

Different way of send broadcast to other applications

We could send broadcast to other applications in 3 ways sendOrderedBroadcast(Intent, String) method sends broadcasts to one receiver at a time. sendBroadcast(Intent) method sends broadcasts to all receivers in an undefined order. LocalBroadcastManager.sendBroadcast method sends broadcasts to receivers that are in the same app as the sender.

Android - Context

This vs getContext vs getApplicationContext Context in Android is an interface to global information about and application environment, it allows access to application-specific resources and classes, as well as up-calls for application-level such as launching activities, broadcasting and receiving intents, etc. It’s the context of the current state of the application. It lets newly-created objects understand what is the actual state of the application. Actions that involve Context are:  Loading a resource  Launching a new activity  Creating views  Obtaining system service There are Different invoking methods by which you can get context, you can use:  getApplicationContext()  getContext()  getBaseContext() or use the reserved word “this” when you are in the Activity class. These invoking methods are used for different contexts, there are two main contexts in Android framework Application and Activity context, Application context is attached to the