Top "Android-context" questions

Interface to global information about an application environment

Diffinitive rules for using Android's getBaseContext, getApplicationContext or using an Activity's "this"

I've googled this question a lot and have found many differing recommendations on when to use getBaseContext, getApplicationContext or an …

android android-context
How to start an Intent if context is not Activity Context but Application Context

I'm trying to start an activity from a class that extends BroadcastReceiver. public void onReceive(Context context, Intent intent) { the …

android android-intent android-context
How to obtain AssetManager without reference to Context?

I have a class that needs to obtain a reference to it's application's AssetManager. This class does not extend any …

android android-context
Android Context without being in an activity? And other activity-less programming?

I'll try really hard to turn this into one comprehensive question: I'm writing a method to get a String that …

android android-activity gps location android-context
Why does AlertDialog.Builder(Context context) only accepts Activity as a parameter?

In my ongoing learning process (dialog boxes this time), I discovered that this works: AlertDialog.Builder builder = new AlertDialog.Builder(…

android android-activity android-alertdialog android-context
What is the difference between this, getContext() and getActivity()?

I am very confused with the usage of all these that where should we use them.

android android-activity android-context
Android DataBinding where to get context?

I have TextView for showing time. I want to use Android's DataBinding plugin. For formatting time I am using DateUtils.…

android data-binding view android-context
Displaying a Toast message from the Application class

I have several classes in my application. Some are Activities, Services and Pure java classes. I know i can display …

android toast android-context
Android : References to a Context and memory leaks

I've read that it is a mistake and a source of memory leaks in Android application to keep a long-lived …

android android-context
Android context outside of Activity class

I am trying to handle exceptions in my application. I am trying to log the exception, then use Toast to …

android android-activity android-context