Instead of :
Context appContext = this.getApplicationContext();
you should use a pointer to the activity you’re in (probably this
).
I got bitten by this today too, the annoying part is the getApplicationContext()
is verbatim from developer.android.com 🙁
More Related Contents:
- Android ‘Unable to add window — token null is not for an application’ exception
- How to prevent a dialog from closing when a button is clicked
- Android Activity as a dialog
- What APIs are used to draw over other apps (like Facebook’s Chat Heads)?
- How to handle screen orientation change when progress dialog and background thread active?
- Dialog with transparent background in Android
- How to dismiss the dialog with click on outside of the dialog?
- Android: Unable to add window. Permission denied for this window type
- Unable instantiate android.gms.maps.MapFragment
- ActionBarCompat: java.lang.IllegalStateException: You need to use a Theme.AppCompat
- Android activity over default lock screen
- Calling startActivity() from outside of an Activity?
- Can’t create handler inside thread which has not called Looper.prepare()
- How to display progress dialog before starting an activity in Android?
- Android DialogFragment vs Dialog
- How do I maintain the Immersive Mode in Dialogs?
- TYPE_SYSTEM_OVERLAY in ICS
- Get date from datepicker using dialogfragment
- How to create a number picker dialog?
- Change background of ProgressDialog
- findViewById() returns null for Views in a Dialog
- Error:Execution failed for task ‘:app:transformClassesWithDexForDebug’ in android studio
- How to make custom dialog with rounded corners in android
- How do I fire an event when click occurs outside a dialog
- Alternative to “FLAG_BLUR_BEHIND” in Android?
- What is WindowManager in android?
- AlertDialog with positive button and validating custom EditText
- android Exit from full screen mode
- Show dialog activity over another app from background
- Show dialog from fragment?