List of usage examples for android.content Context getApplicationInfo
public abstract ApplicationInfo getApplicationInfo();
From source file:Main.java
public static String getAppName(Context context) { ApplicationInfo var1 = context.getApplicationInfo(); return var1.loadLabel(context.getPackageManager()).toString(); }
From source file:Main.java
public static int tryToGetIconFormStringOrGetFromApplication(String iconName, Context context) { int iconId = context.getApplicationInfo().icon; if (null != iconName) { int customId = context.getResources().getIdentifier(iconName, "drawable", context.getPackageName()); if (0 != customId) { iconId = customId;//from w w w. j a v a 2 s. c o m } } return iconId; }
From source file:Main.java
public static String getSharedLibsPath(Context context) { return String.format("%s/lib/", context.getApplicationInfo().dataDir); }
From source file:Main.java
public static String getDataDir(Context ctx) { ApplicationInfo ai = ctx.getApplicationInfo(); if (ai.dataDir != null) return fixLastSlash(ai.dataDir); else/*from w w w .java2 s . c o m*/ return "/data/data/" + ai.packageName + "/"; }
From source file:Main.java
public static boolean isDebuggable(Context context) { return (0 != (context.getApplicationInfo().flags &= ApplicationInfo.FLAG_DEBUGGABLE)); }
From source file:Main.java
public static final String getProfilePath(final Context context) { ApplicationInfo appInfo = context.getApplicationInfo(); return appInfo.dataDir; }
From source file:Main.java
public static String getName(@NonNull Context context) { return context.getApplicationInfo().packageName; }
From source file:Main.java
/** * Check if android:debuggable is true //from w w w .j a va2s . c o m * @param context * @return */ public static boolean isDebuggable(Context context) { ApplicationInfo ai = context.getApplicationInfo(); if (ai == null) { return false; } return (ai.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0; }
From source file:Main.java
public static final String getExecutablePath(final Context context) { ApplicationInfo appInfo = context.getApplicationInfo(); return appInfo.sourceDir; }
From source file:Main.java
/** * Gets the application name specified by android:label in the AndroidManifest.xml. * It does not work if you hard-code your app name like android:label="MyApp". * Use a string resource such as @string/app_name. * @param context the context/* ww w .j a v a 2s.c o m*/ * @return application name */ public static String getApplicationName(@NonNull Context context) { int stringId = context.getApplicationInfo().labelRes; return context.getString(stringId); }