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

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

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

Activity.setIntent介绍

暂无

代码示例

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

/**
 * @param newIntent
 * @see android.app.Activity#setIntent(android.content.Intent)
 */
public void setIntent(Intent newIntent) {
  mActivity.setIntent(newIntent);
}

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

@Override
public void setIntent(android.content.Intent intent0) {
  mOriginActivity.setIntent(intent0);
}

代码示例来源:origin: MRezaNasirloo/Slick

public static int getId(@NonNull Activity activity) {
  final Intent intent = activity.getIntent();
  if (intent.hasExtra(SLICK_UNIQUE_KEY)) {
    return intent.getIntExtra(SLICK_UNIQUE_KEY , -1);
  } else {
    int id = UUID.randomUUID().toString().hashCode();
    intent.putExtra(SLICK_UNIQUE_KEY, id);
    activity.setIntent(intent);
    return id;
  }
}

代码示例来源:origin: RealMoMo/Study_Android_Demo

@Override
public Activity newActivity(ClassLoader cl, String className, Intent intent) throws InstantiationException, IllegalAccessException, ClassNotFoundException {
  if (Constants.DEBUG) Log.e(TAG, "newActivity");
  if (mPluginManager.hookToPluginActivity(intent)) {
    String targetClassName = intent.getComponent().getClassName();
    PluginApp pluginApp = mPluginManager.getLoadedPluginApk();
    Activity activity = mBase.newActivity(pluginApp.mClassLoader, targetClassName, intent);
    activity.setIntent(intent);
    ReflectUtil.setField(ContextThemeWrapper.class, activity, Constants.FIELD_RESOURCES, pluginApp.mResources);
    return activity;
  }
  if (Constants.DEBUG) Log.e(TAG, "super.newActivity(...)");
  return super.newActivity(cl, className, intent);
}

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

@Override
public Activity newActivity(ClassLoader cl, String className, Intent intent) throws InstantiationException, IllegalAccessException, ClassNotFoundException {
  if (className.startsWith(ComponentFinder.DEFAULT_ACTIVITY_PROXY_PREFIX)) {
    // 插件代理Activity,替换回插件真实的Activity
    String[] result = IntentUtils.parsePkgAndClsFromIntent(intent);
    String packageName = result[0];
    String targetClass = result[1];
    PluginDebugLog.runtimeLog(TAG, "newActivity: " + className + ", targetClass: " + targetClass);
    if (!TextUtils.isEmpty(packageName)) {
      PluginLoadedApk loadedApk = PluginManager.getPluginLoadedApkByPkgName(packageName);
      if (loadedApk != null && targetClass != null) {
        Activity activity = mHostInstr.newActivity(loadedApk.getPluginClassLoader(), targetClass, intent);
        activity.setIntent(intent);
        if (!dispatchToBaseActivity(activity)) {
          // 这里需要替换Resources,是因为ContextThemeWrapper会缓存一个Resource对象,而在Activity#attach()和
          // Activity#onCreate()之间,系统会调用Activity#setTheme()初始化主题,Android 4.1+
          ReflectionUtils.on(activity).setNoException("mResources", loadedApk.getPluginResource());
        }
        return activity;
      } else if (loadedApk == null) {
        // loadedApk 为空,可能是正在恢复进程,跳转到 RecoveryActivity
        return mHostInstr.newActivity(cl, mRecoveryHelper.selectRecoveryActivity(className), intent);
      }
    }
  }
  return mHostInstr.newActivity(cl, className, intent);
}

相关文章

Activity类方法