当前位置: 首页>>代码示例>>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;未经允许,请勿转载。