android.app.Activity.getTaskId()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(2.5k)|赞(0)|评价(0)|浏览(499)

本文整理了Java中android.app.Activity.getTaskId()方法的一些代码示例,展示了Activity.getTaskId()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Activity.getTaskId()方法的具体详情如下:
包路径:android.app.Activity
类名称:Activity
方法名:getTaskId

Activity.getTaskId介绍

暂无

代码示例

代码示例来源:origin: typ0520/fastdex

public void onActivityCreated(Activity activity, Bundle savedInstanceState) {
    sActivitiesRefs.put(activity, ACTIVITY_CREATED);
    if (sFirstTaskId == 0L) {
      sFirstTaskId = activity.getTaskId();
    }
  }
};

代码示例来源:origin: com.uphyca/android-junit4-robolectric

/**
 * @return
 * @see android.app.Activity#getTaskId()
 */
public int getTaskId() {
  return mActivity.getTaskId();
}

代码示例来源:origin: iqiyi/Neptune

@Override
public int getTaskId() {
  return mOriginActivity.getTaskId();
}

代码示例来源:origin: derry/delion

private Set<Integer> getTaskIdsForVisibleActivities() {
  List<WeakReference<Activity>> runningActivities =
      ApplicationStatus.getRunningActivities();
  Set<Integer> visibleTaskIds = new HashSet<>();
  for (int i = 0; i < runningActivities.size(); i++) {
    Activity activity = runningActivities.get(i).get();
    if (activity == null) continue;
    int activityState = ApplicationStatus.getStateForActivity(activity);
    if (activityState != ActivityState.STOPPED
        && activityState != ActivityState.DESTROYED) {
      visibleTaskIds.add(activity.getTaskId());
    }
  }
  return visibleTaskIds;
}

代码示例来源:origin: derry/delion

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);
}

代码示例来源:origin: jbruchanov/AnUitor

data.put("StringValue", String.valueOf(activity));
data.put("Parent:", activity.getParent() != null ? activity.getParent() : null);
data.put("TaskID", activity.getTaskId());
data.put("Title", activity.getTitle());
data.put("TitleColor", getStringColor(activity.getTitleColor()));

相关文章

Activity类方法