本文整理汇总了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);
}
}
}
示例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);
}
}
}
示例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);
}
示例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;
}
}