Example usage for android.content Context getApplicationContext

List of usage examples for android.content Context getApplicationContext

Introduction

In this page you can find the example usage for android.content Context getApplicationContext.

Prototype

public abstract Context getApplicationContext();

Source Link

Document

Return the context of the single, global Application object of the current process.

Usage

From source file:Main.java

public static int getAppIconResourceId(Context context) {
    return context.getApplicationContext().getApplicationInfo().icon;
}

From source file:Main.java

public static Context getApplicationContext(Context context) {
    return context.getApplicationContext();
}

From source file:Main.java

public static void init(Context ctx) {
    sContext = ctx.getApplicationContext();
}

From source file:Main.java

public static void initCache(Context context) {
    sp = context.getApplicationContext().getSharedPreferences("config", Context.MODE_PRIVATE);
    isInitBoolean = true;//from  w  w  w.ja  va 2  s.  c om
}

From source file:Main.java

public static void init(Context mContext) {
    context = mContext.getApplicationContext();
}

From source file:Main.java

public static void init(Context context) {
    sContext = context.getApplicationContext();
}

From source file:Main.java

public static DisplayMetrics getDisplayMetrics(Context context) {
    return context.getApplicationContext().getResources().getDisplayMetrics();
}

From source file:Main.java

public static void install(Context context) {
    sContext = context.getApplicationContext();
}

From source file:Main.java

/**
 * get density of screen//w  ww  . j a v  a2s  . co m
 *
 * @param context Context
 * @return
 */
public static float getDensity(Context context) {
    return context.getApplicationContext().getResources().getDisplayMetrics().density;
}

From source file:Main.java

public static boolean isTablet(Context context) {
    int s = context.getApplicationContext().getResources().getConfiguration().screenLayout;
    s &= Configuration.SCREENLAYOUT_SIZE_MASK;
    return s >= Configuration.SCREENLAYOUT_SIZE_LARGE;
}