當前位置: 首頁>>代碼示例>>Java>>正文


Java Activity.getComponentName方法代碼示例

本文整理匯總了Java中android.app.Activity.getComponentName方法的典型用法代碼示例。如果您正苦於以下問題:Java Activity.getComponentName方法的具體用法?Java Activity.getComponentName怎麽用?Java Activity.getComponentName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.app.Activity的用法示例。


在下文中一共展示了Activity.getComponentName方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: handleCreate

import android.app.Activity; //導入方法依賴的package包/類
final void handleCreate(String plugin, Activity activity, String container) {
    ComponentName cn = activity.getComponentName();
    if (cn != null) {
        container = cn.getClassName();
    }
    if (LOG) {
        LogDebug.d(PLUGIN_TAG, "PACM: activity created h=" + activity.hashCode() + " class=" + activity.getClass().getName() + " container=" + container);
    }
    synchronized (mLock) {
        HashMap<String, ActivityState> map = mStates;
        ActivityState state = map.get(container);
        if (state != null) {
            state.create(plugin, activity);
        }
    }
}
 
開發者ID:wangyupeng1-iri,項目名稱:springreplugin,代碼行數:17,代碼來源:PluginContainers.java

示例2: handleDestroy

import android.app.Activity; //導入方法依賴的package包/類
final void handleDestroy(Activity activity) {
    String container = null;
    //
    ComponentName cn = activity.getComponentName();
    if (cn != null) {
        container = cn.getClassName();
    }
    if (LOG) {
        LogDebug.d(PLUGIN_TAG, "PACM: activity destroy h=" + activity.hashCode() + " class=" + activity.getClass().getName() + " container=" + container);
    }
    if (container == null) {
        return;
    }
    synchronized (mLock) {
        HashMap<String, ActivityState> map = mStates;
        ActivityState state = map.get(container);
        if (state != null) {
            state.removeRef(activity);
        }
    }
}
 
開發者ID:wangyupeng1-iri,項目名稱:springreplugin,代碼行數:22,代碼來源:PluginContainers.java

示例3: onDownloadStart

import android.app.Activity; //導入方法依賴的package包/類
/**
 * Notify the host application a download should be done, or that the data
 * should be streamed if a streaming viewer is available.
 * 
 * @param activity
 *            Activity requesting the download.
 * @param url
 *            The full url to the content that should be downloaded
 * @param userAgent
 *            User agent of the downloading application.
 * @param contentDisposition
 *            Content-disposition http header, if present.
 * @param mimetype
 *            The mimetype of the content reported by the server
 * @param privateBrowsing
 *            If the request is coming from a private browsing tab.
 */
public static void onDownloadStart(Activity activity, String url, String userAgent,
		String contentDisposition, String mimetype, boolean privateBrowsing) {
	// if we're dealing wih A/V content that's not explicitly marked
	// for download, check if it's streamable.
	if (contentDisposition == null
			|| !contentDisposition.regionMatches(true, 0, "attachment", 0, 10)) {
		// query the package manager to see if there's a registered handler
		// that matches.
		Intent intent = new Intent(Intent.ACTION_VIEW);
		intent.setDataAndType(Uri.parse(url), mimetype);
		intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
		ResolveInfo info = activity.getPackageManager().resolveActivity(intent,
				PackageManager.MATCH_DEFAULT_ONLY);
		if (info != null) {
			ComponentName myName = activity.getComponentName();
			// If we resolved to ourselves, we don't want to attempt to
			// load the url only to try and download it again.
			if (!myName.getPackageName().equals(info.activityInfo.packageName)
					|| !myName.getClassName().equals(info.activityInfo.name)) {
				// someone (other than us) knows how to handle this mime
				// type with this scheme, don't download.
				try {
					activity.startActivity(intent);
					return;
				} catch (ActivityNotFoundException ex) {
					// Best behavior is to fall back to a download in this
					// case
				}
			}
		}
	}
	onDownloadStartNoStream(activity, url, userAgent, contentDisposition, mimetype,
			privateBrowsing);
}
 
開發者ID:NewCasino,項目名稱:browser,代碼行數:52,代碼來源:DownloadHandler.java

示例4: fetchPluginByPitActivity

import android.app.Activity; //導入方法依賴的package包/類
private String fetchPluginByPitActivity(Activity a) {
    PluginContainers.ActivityState state = null;
    if (a.getComponentName() != null) {
        state = mPluginMgr.mClient.mACM.lookupByContainer(a.getComponentName().getClassName());
    }

    if (state != null) {
        return state.plugin;
    } else {
        return null;
    }
}
 
開發者ID:wangyupeng1-iri,項目名稱:springreplugin,代碼行數:13,代碼來源:PluginLibraryInternalProxy.java


注:本文中的android.app.Activity.getComponentName方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。