List of usage examples for android.content Context getPackageName
public abstract String getPackageName();
From source file:Main.java
public static int getColorId(Context context, String resName) { return context.getResources().getIdentifier(resName, "color", context.getPackageName()); }
From source file:Main.java
static public int getIdentifier(Context context, String name) { return context.getResources().getIdentifier(name, "id", context.getPackageName()); }
From source file:Main.java
public static int getResId(Context context, String filename) { return context.getResources().getIdentifier(filename, "raw", context.getPackageName()); }
From source file:Main.java
public static int getVersionCode(Context context) { try {//from w w w . j a v a 2 s .co m return context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionCode; } catch (PackageManager.NameNotFoundException e) { return 0; } }
From source file:Main.java
public static String getAppVersionName(Context context) { try {// w ww. j a v a 2 s.com return context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionName; } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); } return "1.0.0"; }
From source file:Main.java
public static int getVersionApp(Context context) { try {/*from w ww. j ava 2 s.c om*/ return context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionCode; } catch (NameNotFoundException e) { return 0; } }
From source file:Main.java
public static String getVerName(Context context) { try {/* w w w .j a v a2s . c o m*/ return context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionName; } catch (NameNotFoundException e) { } return ""; }
From source file:Main.java
public static String getVersionName(Context context) { try {/*from w ww . j a v a 2s .com*/ return context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionName; } catch (NameNotFoundException e) { return null; } }
From source file:Main.java
public static String getAppVersion(Context context) { try {// w w w. j a v a 2 s . c om return context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionName; } catch (NameNotFoundException e) { return ""; } }
From source file:Main.java
static String VersionName(Context context) { try {/* www .ja va 2 s .co m*/ return context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionName; } catch (PackageManager.NameNotFoundException e) { return "Unknown"; } }