List of usage examples for android.content.pm PackageManager getApplicationLabel
public abstract CharSequence getApplicationLabel(ApplicationInfo info);
From source file:Main.java
public static String getPackageName(Activity instance) { PackageManager pManager = instance.getPackageManager(); return pManager.getApplicationLabel(instance.getApplicationInfo()).toString(); }
From source file:Main.java
public static String getAppLabel(Context context, ApplicationInfo info) { PackageManager pManager = context.getPackageManager(); return pManager.getApplicationLabel(info).toString(); }
From source file:Main.java
private static String obtatinAppName(Context context) throws NameNotFoundException { PackageManager packageManager = context.getPackageManager(); return packageManager .getApplicationLabel(/*from w w w.j av a2 s .com*/ packageManager.getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA)) .toString(); }
From source file:Main.java
public static String getAppName(Context context) { ApplicationInfo applicationInfo = context.getApplicationInfo(); PackageManager packageManager = context.getPackageManager(); String appName = packageManager.getApplicationLabel(applicationInfo).toString(); return appName; }
From source file:Main.java
/** * Get the name of this app as specified in manifest. * * @param context/*from w w w . j a v a 2 s . c o m*/ * @return String */ public static String getAppName(Context context) { try { PackageManager packageManager = context.getPackageManager(); return packageManager.getApplicationLabel(context.getApplicationInfo()).toString(); } catch (Exception e) { e.printStackTrace(); } return "Unknown"; }
From source file:Main.java
public static boolean hasShortcut(Context cx) { boolean result = false; String title = null;//w w w. ja v a 2 s .co m try { final PackageManager pm = cx.getPackageManager(); title = pm.getApplicationLabel(pm.getApplicationInfo(cx.getPackageName(), PackageManager.GET_META_DATA)) .toString(); } catch (Exception e) { e.printStackTrace(); } final String AUTHORITY; if (android.os.Build.VERSION.SDK_INT < 8) { AUTHORITY = "com.android.launcher.settings"; } else { AUTHORITY = "com.android.launcher2.settings"; } final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY + "/favorites?notify=true"); final Cursor c = cx.getContentResolver().query(CONTENT_URI, null, "title=?", new String[] { title }, null); if (c != null && c.moveToFirst()) { c.close(); result = true; } return result; }
From source file:Main.java
public static CharSequence getApplicationLabel(Context context) { PackageManager pm = context.getPackageManager(); ApplicationInfo info = context.getApplicationInfo(); CharSequence appLabel = pm.getApplicationLabel(info); return appLabel; }
From source file:Main.java
/** * Get application name.// w ww .ja v a 2 s . c o m * * @param activity * current activity. * @return application name. This equals to the app title that appears in * settings->application. * @throws android.content.pm.PackageManager.NameNotFoundException */ public static String getAppName(Activity activity) throws PackageManager.NameNotFoundException { PackageManager pm = activity.getPackageManager(); ApplicationInfo appInfo = pm.getApplicationInfo(activity.getPackageName(), 0); return pm.getApplicationLabel(appInfo).toString(); }
From source file:Main.java
public static String appNameLookup(Context context, String packageName) { try {/*w w w . j ava2s . c om*/ PackageManager pm = context.getPackageManager(); ApplicationInfo ai = pm.getApplicationInfo(packageName, 0); return pm.getApplicationLabel(ai).toString(); } catch (final PackageManager.NameNotFoundException e) { e.printStackTrace(); Log.e("AppsHelper", "Could not resolve name " + packageName); return null; } }
From source file:Main.java
public static String getAppName(Context context) { String appName = ""; try {/*from w w w.java 2s.c o m*/ // ---get the package info--- PackageManager pm = context.getPackageManager(); PackageInfo pi = pm.getPackageInfo(context.getPackageName(), 0); appName = pm.getApplicationLabel(pi.applicationInfo).toString(); if (appName == null || appName.length() <= 0) { return ""; } } catch (Exception e) { Log.e("VersionInfo", "Exception", e); } return appName; }