本文整理汇总了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();
}
}
示例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);
}
示例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);
}
}