List of usage examples for android.content Context getApplicationContext
public abstract Context getApplicationContext();
From source file:Main.java
/** * get screen width/* w w w.j a v a 2s .c o m*/ * * @param context Context * @return */ public static int getScreenWidth(Context context) { return context.getApplicationContext().getResources().getDisplayMetrics().widthPixels; }
From source file:Main.java
/** * get screen height/*from w ww .j ava 2 s . c om*/ * * @param context Context * @return */ public static int getScreenHeight(Context context) { return context.getApplicationContext().getResources().getDisplayMetrics().heightPixels; }
From source file:Main.java
static boolean isDebug(Context context) { return (0 != (context.getApplicationContext() .getApplicationInfo().flags &= ApplicationInfo.FLAG_DEBUGGABLE)); }
From source file:Main.java
/** * /*from w ww. ja v a 2 s . co m*/ * @param context * @return */ public static DisplayMetrics getDisplayMetrics(Context context) { return context.getApplicationContext().getResources().getDisplayMetrics(); }
From source file:Main.java
public static SharedPreferences.Editor getPrefsEditor(Context ctx, String prefsKey) { return ctx.getApplicationContext().getSharedPreferences(prefsKey, Context.MODE_PRIVATE).edit(); }
From source file:Main.java
public static int getScreenHeight(Context ctx) { DisplayMetrics dm = ctx.getApplicationContext().getResources().getDisplayMetrics(); return dm.heightPixels; }
From source file:Main.java
public static int getScreenWidth(Context ctx) { DisplayMetrics dm = ctx.getApplicationContext().getResources().getDisplayMetrics(); return dm.widthPixels; }
From source file:Main.java
public static File getDatabaseFile(Context context) { return context.getApplicationContext().getDatabasePath(DB_NAME); }
From source file:Main.java
public static String getResourcePackageName(Context paramContext) { int i = paramContext.getApplicationContext().getApplicationInfo().icon; if (i > 0) { return paramContext.getResources().getResourcePackageName(i); }/*from w ww . ja v a 2 s. c o m*/ return paramContext.getPackageName(); }
From source file:Main.java
public static int getWidth(Context context) { DisplayMetrics dm = context.getApplicationContext().getResources().getDisplayMetrics(); return dm.widthPixels; }