当前位置: 首页>>代码示例>>Java>>正文


Java ActivityInfo.loadLabel方法代码示例

本文整理汇总了Java中android.content.pm.ActivityInfo.loadLabel方法的典型用法代码示例。如果您正苦于以下问题:Java ActivityInfo.loadLabel方法的具体用法?Java ActivityInfo.loadLabel怎么用?Java ActivityInfo.loadLabel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.content.pm.ActivityInfo的用法示例。


在下文中一共展示了ActivityInfo.loadLabel方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getAvailableThemes

import android.content.pm.ActivityInfo; //导入方法依赖的package包/类
public static HashMap<String, String> getAvailableThemes(Context ctxt){
	HashMap<String, String> result = new HashMap<String, String>();
	result.put("", ctxt.getResources().getString(R.string.app_name));
	
	PackageManager packageManager = ctxt.getPackageManager();
	Intent it = new Intent(SipManager.ACTION_GET_DRAWABLES);
	
	List<ResolveInfo> availables = packageManager.queryBroadcastReceivers(it, 0);
	Log.d(THIS_FILE, "We found " + availables.size() + "themes");
	for(ResolveInfo resInfo : availables) {
		Log.d(THIS_FILE, "We have -- "+resInfo);
		ActivityInfo actInfos = resInfo.activityInfo;
		ComponentName cmp = new ComponentName(actInfos.packageName, actInfos.name);
		String label = (String) actInfos.loadLabel(packageManager);
		if(TextUtils.isEmpty(label)) {
		    label = (String) resInfo.loadLabel(packageManager);
		}
		result.put(cmp.flattenToString(), label);
	}
	
	return result;
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:23,代码来源:Theme.java

示例2: getApplicationInfo

import android.content.pm.ActivityInfo; //导入方法依赖的package包/类
private static ApplicationInfo getApplicationInfo(PackageManager manager, Intent intent) {
    final ResolveInfo resolveInfo = manager.resolveActivity(intent, 0);

    if (resolveInfo == null) {
        return null;
    }

    final ApplicationInfo info = new ApplicationInfo();
    final ActivityInfo activityInfo = resolveInfo.activityInfo;
    info.icon = activityInfo.loadIcon(manager);
    if (info.title == null || info.title.length() == 0) {
        info.title = activityInfo.loadLabel(manager);
    }
    if (info.title == null) {
        info.title = "";
    }
    return info;
}
 
开发者ID:sdrausty,项目名称:buildAPKsSamples,代码行数:19,代码来源:Home.java

示例3: ensureValidName

import android.content.pm.ActivityInfo; //导入方法依赖的package包/类
/**
 * Ensures that we have a valid, non-null name.  If the provided name is null, we will return
 * the application name instead.
 */
@Thunk static CharSequence ensureValidName(Context context, Intent intent, CharSequence name) {
    if (name == null) {
        try {
            PackageManager pm = context.getPackageManager();
            ActivityInfo info = pm.getActivityInfo(intent.getComponent(), 0);
            name = info.loadLabel(pm);
        } catch (PackageManager.NameNotFoundException nnfe) {
            return "";
        }
    }
    return name;
}
 
开发者ID:TeamBrainStorm,项目名称:SimpleUILauncher,代码行数:17,代码来源:InstallShortcutReceiver.java

示例4: doInBackground

import android.content.pm.ActivityInfo; //导入方法依赖的package包/类
@Override
protected Void doInBackground(DonateActivity.DonateItem... params) {
    Context context = mReference.get();
    if (context != null) {
        PackageManager packageManager = context.getPackageManager();
        for (DonateActivity.DonateItem item : params) {
            ActivityInfo ai = packageManager.resolveActivity(item.intent, 0).activityInfo;
            item.label = ai.loadLabel(packageManager);
            item.icon = ai.loadIcon(packageManager);
            this.publishProgress(item);
        }
    }
    return null;
}
 
开发者ID:brevent,项目名称:Brevent,代码行数:15,代码来源:DonateTask.java


注:本文中的android.content.pm.ActivityInfo.loadLabel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。