本文整理匯總了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);
}
}