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 🙁