當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。