This has me stumped, I was using this in Android 2.1-r8 SDK: ProgressDialog.show(getApplicationContext(), ....); and also in Toast t = Toast.makeText(getApplicationContext(),....); using getApplicationContext() crashes both ProgressDialog and Toast …....
  • May 21, 2022
  • 0 Comments
I’ve found the R.string pretty awesome for keeping hardcoded strings out of my code, and I’d like to keep using it in a utility class that works with models...
  • May 16, 2022
  • 0 Comments
I am aware of the availability of Context.getApplicationContext() and View.getContext(), through which I can actually call Context.getPackageName() to retrieve the package name of an application. They work if I...
  • May 8, 2022
  • 0 Comments
I couldn’t find a satisfying answer to this, so here we go: what’s the deal with Activity/Service.getApplication() and Context.getApplicationContext()? In our application, both return the same object. In an...
  • May 6, 2022
  • 0 Comments
In an Android app, is there anything wrong with the following approach: public class MyApp extends android.app.Application { private static MyApp instance; public MyApp() { instance = this; }...
  • May 4, 2022
  • 0 Comments