Top "Android-context" questions

Interface to global information about an application environment

Determine if context is a Specific Activity

I'm passing the Activity context to a dialog but that dialog is global to other Activities, so its possible that …

java android android-activity android-context
How do you get hold of an Android Context for a Junit test from a Java Project?

I need to access and Android context for a JUnit Test. I have tried using MockContext and extending the AndroidTestCase …

android android-context
Why does FileOutputStream throw FileNotFoundException?

The Android Developer reference (this page) says: Throws FileNotFoundException But at the very start, it says: Open a private file …

java android java-io android-file android-context
Is it safe to save the app context to a static variable in Android?

I know that usage of static variables on Android is quite risky, especially if you reference them to activities. However, …

android process static android-context
Using Context with AppCompatActivity

I'm currently working on an Android app, and working with serializing files. I have a method that serializes a Java …

android android-context appcompatactivity
Use of Context to start another Activity

To start an Activity you need an Intent, like: Intent i = new Intent(context, class) So to fill in the …

android android-context
Passing Activity Context to constructors to use internally - is this bad

Is it bad practice to pass the Context to a constructor and save it as a private variable for internal …

android memory-leaks android-context
How to get context for BaseAdapter in Android

I have a class named BinderData which extends BaseAdapter. I want to get the base class context. I tried to …

android baseadapter android-context
Android: Start Service with Context.startService vs PendingIntent.getService

Context.startService Intent intent = new Intent(context, MyService.class); context.startService(intent); PendingIntent.getService Intent intent = new Intent(context, MyService.…

android android-intent android-context android-pendingintent
Android JUnit4 Testing - Where to get Context from?

I have to build an app with sqlite usage. Now I want to write my unit tests. These unit tests …

android sqlite unit-testing android-context