PackageManager getApplicationLabel - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for PackageManager getApplicationLabel method.

This code example shows how to use the following methods:getApplicationInfo, getApplicationLabel
    private CharSequence getAppName(String packageName) {
        final PackageManager pm = mContext.getPackageManager();
        ApplicationInfo ai;
 
        try { 
            ai = pm.getApplicationInfo(packageName, 0);
        } catch (final NameNotFoundException e) {
            ai = null;
        } 
 
        if (ai != null) {
            return pm.getApplicationLabel(ai);
        } 
        return null; 
    } 
} 
7
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getApplicationInfo, getApplicationLabel
 
    @CalledByNative 
    public static String getPackageLabel(Context context) {
        try { 
            PackageManager packageManager = context.getPackageManager();
            ApplicationInfo appInfo = packageManager.getApplicationInfo(context.getPackageName(),
                    PackageManager.GET_META_DATA);
            CharSequence label = packageManager.getApplicationLabel(appInfo);
            return  label != null ? label.toString() : "";
        } catch (NameNotFoundException e) {
            return ""; 
        } 
    } 
 
    @CalledByNative 
    public static String getPackageName(Context context) {
        String packageName = context != null ? context.getPackageName() : null;
        return packageName != null ? packageName : "";
    } 
 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getApplicationInfo, getApplicationLabel, getPackageInfo
This code example shows how to use the following methods:getApplicationInfo, getApplicationLabel
public final class Utility { 
	static final String PACKAGE = "com.steamcommunity.siplus.steamscreenshots";
 
	static String applicationLabel(PackageManager packageManager, String packageName) {
		try { 
			ApplicationInfo info = packageManager.getApplicationInfo(packageName, 0);
			return (String)(packageManager.getApplicationLabel(info));
		} catch (NameNotFoundException e) {
			return packageName;
		} 
	} 
 
	static void closeCloseable(Closeable closeable) {
		try { 
			closeable.close();
		} catch (IOException e) {}
	} 
 
	static void enableActionBarBack(Activity activity) {
		ActionBar actionBar = activity.getActionBar();
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getApplicationInfo, getApplicationLabel
This code example shows how to use the following methods:getApplicationInfo, getApplicationLabel
    public static CharSequence getApplicationLabel(Context context)
    { 
        try 
        { 
            PackageManager pm = context.getPackageManager();
            ApplicationInfo ai = pm.getApplicationInfo(context.getPackageName(),0);
            return pm.getApplicationLabel(ai);
        } 
        catch (NameNotFoundException e)
        { 
            return "AnonDroid"; 
        } 
    } 
 
    public static String getApplicationVersion(Context context)
    { 
        try 
        { 
            PackageManager pm = context.getPackageManager();
            return pm.getPackageInfo(context.getPackageName(),0).versionName;
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getApplicationInfo, getApplicationLabel
    } 
 
    public static CharSequence getApplicationLabel(Context context) {
        try { 
            PackageManager pm = context.getPackageManager();
            ApplicationInfo ai = pm.getApplicationInfo(context.getPackageName(), 0);
            return pm.getApplicationLabel(ai);
        } catch (NameNotFoundException e) {
            return "AnonDroid"; 
        } 
    } 
 
    public static String getApplicationVersion(Context context) {
        try { 
            PackageManager pm = context.getPackageManager();
            return pm.getPackageInfo(context.getPackageName(), 0).versionName;
        } catch (NameNotFoundException e) {
            return ""; 
        } 
    } 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getApplicationLabel
            return ""; 
        } 
    } 
 
    public CharSequence getLabel() {
        return packageManager.getApplicationLabel(applicationInfo);
    } 
     
    public String getAndroidVersion() {
        return Build.VERSION.RELEASE;
    } 
 
    public AppInfo(Context context) {
        packageManager = context.getPackageManager();
        packageName = context.getPackageName();
        applicationInfo = context.getApplicationInfo();
    } 
} 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getApplicationLabel
    private final PackageInfo mPackageInfo;
    private final String mApplicationLabel;
     
    private static String getApplicationLabel(PackageManager pm, PackageInfo info) {
        if(info.applicationInfo != null) {
            CharSequence label = pm.getApplicationLabel(info.applicationInfo);
            if(label != null) {
                return label.toString();
            } 
        } 
        return info.packageName;
    } 
         
    public AndroidPackage(PackageManager packageManager, Drawable icon, PackageInfo packageInfo) {
        mPackageInfo = packageInfo;
        mPackageIcon = icon;
        mApplicationLabel = getApplicationLabel(packageManager, packageInfo);
    } 
     
    public Drawable getIcon() {
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:getApplicationLabel
        return wrapped.getXml(packageName, resid, appInfo);
    } 
 
    @Override 
    public CharSequence getApplicationLabel(ApplicationInfo info) {
        return wrapped.getApplicationLabel(info);
    } 
 
    @Override 
    public Resources getResourcesForActivity(ComponentName activityName)
    throws NameNotFoundException { 
        return wrapped.getResourcesForActivity(activityName);
    } 
 
    @Override 
    public Resources getResourcesForApplication(ApplicationInfo app) throws NameNotFoundException {
        return wrapped.getResourcesForApplication(app);
    } 
 
    @Override 
4
CodeRank
Experience pair programming with AI  Get Codota for Java

Related PackageManager getApplicationLabel Questions & Answers:

getApplicationLabel Method Overview
Return the label to use for this application.
See Code Examples for other Android PackageManager Methods: