本文整理汇总了Java中android.app.Activity.getTaskId方法的典型用法代码示例。如果您正苦于以下问题:Java Activity.getTaskId方法的具体用法?Java Activity.getTaskId怎么用?Java Activity.getTaskId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.app.Activity
的用法示例。
在下文中一共展示了Activity.getTaskId方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: focusChromeIfNecessary
import android.app.Activity; //导入方法依赖的package包/类
private void focusChromeIfNecessary() {
Set<Integer> visibleTaskIds = getTaskIdsForVisibleActivities();
int tabbedTaskId = -1;
List<WeakReference<Activity>> runningActivities =
ApplicationStatus.getRunningActivities();
for (int i = 0; i < runningActivities.size(); i++) {
Activity activity = runningActivities.get(i).get();
if (activity == null) continue;
if (activity instanceof ChromeTabbedActivity) {
tabbedTaskId = activity.getTaskId();
break;
}
}
// If the task containing the tabbed activity is visible, then do nothing as there is no
// snapshot that would need to be regenerated.
if (visibleTaskIds.contains(tabbedTaskId)) return;
Context context = ContextUtils.getApplicationContext();
Intent startIntent = new Intent(Intent.ACTION_MAIN);
startIntent.setPackage(context.getPackageName());
startIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(startIntent);
}
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:27,代码来源:IncognitoNotificationService.java
示例2: onActivityCreated
import android.app.Activity; //导入方法依赖的package包/类
@Override
public void onActivityCreated(Activity activity, Bundle savedInstanceState) {
Log.w(TAG, activity.getClass().getName() + "@" + activity.hashCode() + " " + activity.getTaskId() + " " + " onActivityCreated");
TaskInfo taskInfo = new TaskInfo(activity.getTaskId(), activity.hashCode(), activity.getClass().getSimpleName());
taskInfo.setOnCreate(true);
qhandler.add(taskInfo);
}