Click here to Skip to main content
15,919,422 members

Comments by Izbyakov (Top 1 by date)

Izbyakov 26-Jun-13 10:06am View    
Reason for my vote of 1 \n There is no need to use cast.

Just use static variable and you can get access to application object without casting.

public class BaseApplication extends Application {

public BaseApplication() {
currentApplication = this;
}


private static BaseApplication currentApplication;

public static Context getAppContext() {
return currentApplication.getApplicationContext();
}
}