當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。