本文整理匯總了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);
}