当前位置: 首页>>代码示例>>Java>>正文


Java Intent.replaceExtras方法代码示例

本文整理汇总了Java中android.content.Intent.replaceExtras方法的典型用法代码示例。如果您正苦于以下问题:Java Intent.replaceExtras方法的具体用法?Java Intent.replaceExtras怎么用?Java Intent.replaceExtras使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.content.Intent的用法示例。


在下文中一共展示了Intent.replaceExtras方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onActivityResult

import android.content.Intent; //导入方法依赖的package包/类
/**
 * Sends user to edit profile
 * @param requestCode
 * @param resultCode
 * @param data
 */
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if(resultCode == DummyMainActivity.VIEW_EDIT_PROFILE){
        Intent intent = new Intent();
        intent.replaceExtras(data);
        setResult(DummyMainActivity.VIEW_EDIT_PROFILE, intent);
        finish();
    }
}
 
开发者ID:CMPUT301F17T17,项目名称:Habitizer,代码行数:17,代码来源:LoginActivity.java

示例2: modify

import android.content.Intent; //导入方法依赖的package包/类
public static Intent modify(Activity target, Intent intent) {
    if (!intent.hasExtra(ApkConstant.EXTRA_APK_PATH)
            && target.getIntent().hasExtra(ApkConstant.EXTRA_APK_PATH)) {
        Bundle extras = intent.getExtras();
        if (extras != null) {
            intent.replaceExtras(new Bundle());
            String extras_id = ApkExtras.putExtras(extras);
            intent.putExtra(ApkConstant.EXTRA_APK_EXTRAS, extras_id);
        }
        String apkPath = target.getIntent().getStringExtra(ApkConstant.EXTRA_APK_PATH);
        intent.putExtra(ApkConstant.EXTRA_APK_PATH, apkPath);
        // launch mode
        if (intent.getComponent() != null) {
            try {
                ActivityInfo activityInfo = ApkLoaded.get(target, apkPath).getActivityInfo(intent.getComponent().getClassName());
                String launchModeStr = HookActivity_Component.STANDARD;
                int launchMode = activityInfo.launchMode;
                if (launchMode == ActivityInfo.LAUNCH_SINGLE_INSTANCE) {
                    launchModeStr = HookActivity_Component.SINGLE_INSTANCE;
                } else if (launchMode == ActivityInfo.LAUNCH_SINGLE_TASK) {
                    launchModeStr = HookActivity_Component.SINGLE_TASK;
                } else if (launchMode == ActivityInfo.LAUNCH_SINGLE_TOP) {
                    launchModeStr = HookActivity_Component.SINGLE_TOP;
                }
                intent.putExtra(ApkConstant.EXTRA_APK_LAUNCH_MODE, launchModeStr);
            } catch (Exception e) {
            }
        }
    }
    return HookActivity_Component.modify(intent);
}
 
开发者ID:LiangMaYong,项目名称:android-apkbox,代码行数:32,代码来源:HookActivity_Intent.java

示例3: sanitizeIntent

import android.content.Intent; //导入方法依赖的package包/类
/**
 * Sanitizes an intent. In case the intent cannot be unparcelled, all extras will be removed to
 * make it safe to use.
 * @return A safe to use version of this intent.
 */
public static Intent sanitizeIntent(final Intent incomingIntent) {
    if (incomingIntent == null) return null;
    try {
        incomingIntent.getBooleanExtra("TriggerUnparcel", false);
        return incomingIntent;
    } catch (BadParcelableException e) {
        Log.e(TAG, "Invalid incoming intent.", e);
        return incomingIntent.replaceExtras((Bundle) null);
    }
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:16,代码来源:IntentUtils.java


注:本文中的android.content.Intent.replaceExtras方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。