android.content.Intent.removeExtra()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(7.9k)|赞(0)|评价(0)|浏览(195)

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

Intent.removeExtra介绍

暂无

代码示例

代码示例来源:origin: android-hacker/VirtualXposed

private void handleUninstallShortcutIntent(Intent intent) {
  Intent shortcut = intent.getParcelableExtra(Intent.EXTRA_SHORTCUT_INTENT);
  if (shortcut != null) {
    ComponentName componentName = shortcut.resolveActivity(getPM());
    if (componentName != null) {
      Intent newShortcutIntent = new Intent();
      newShortcutIntent.putExtra("_VA_|_uri_", shortcut.toUri(0));
      newShortcutIntent.setClassName(getHostPkg(), Constants.SHORTCUT_PROXY_ACTIVITY_NAME);
      newShortcutIntent.removeExtra(Intent.EXTRA_SHORTCUT_INTENT);
      intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, newShortcutIntent);
    }
  }
}

代码示例来源:origin: Tencent/tinker

private boolean processIntent(ClassLoader cl, Intent intent) {
  if (intent == null) {
    return false;
  }
  ShareIntentUtil.fixIntentClassLoader(intent, cl);
  final ComponentName oldComponent = intent.getParcelableExtra(EnvConsts.INTENT_EXTRA_OLD_COMPONENT);
  if (oldComponent == null) {
    Log.w(TAG, "oldComponent was null, start " + intent.getComponent() + " next.");
    return false;
  }
  final String oldComponentName = oldComponent.getClassName();
  final ActivityInfo targetAInfo = IncrementComponentManager.queryActivityInfo(oldComponentName);
  if (targetAInfo == null) {
    Log.e(TAG, "Failed to query target activity's info,"
        + " perhaps the target is not hotpluged component. Target: " + oldComponentName);
    return false;
  }
  intent.setComponent(oldComponent);
  intent.removeExtra(EnvConsts.INTENT_EXTRA_OLD_COMPONENT);
  return true;
}

代码示例来源:origin: Tencent/tinker

fixStubActivityInfo(aInfo, targetAInfo);
  maybeHackedIntent.setComponent(oldComponent);
  maybeHackedIntent.removeExtra(EnvConsts.INTENT_EXTRA_OLD_COMPONENT);
} catch (Throwable thr) {
  Log.e(TAG, "exception in handleMessage.", thr);

代码示例来源:origin: android-hacker/VirtualXposed

newShortcutIntent.putExtra("_VA_|_uri_", shortcut.toUri(0));
newShortcutIntent.putExtra("_VA_|_user_id_", VUserHandle.myUserId());
intent.removeExtra(Intent.EXTRA_SHORTCUT_INTENT);
intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, newShortcutIntent);
      Bitmap newIcon = BitmapUtils.drawableToBitmap(iconDrawable);
      if (newIcon != null) {
        intent.removeExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE);
        intent.putExtra(Intent.EXTRA_SHORTCUT_ICON, newIcon);

代码示例来源:origin: k9mail/k-9

data.putExtra(EXTRA_DATA_LENGTH, (long) expectedSize);
} else {
  data.removeExtra(EXTRA_PROGRESS_MESSENGER);

代码示例来源:origin: k9mail/k-9

data.putExtra(EXTRA_DATA_LENGTH, (long) expectedSize);
} else {
  data.removeExtra(EXTRA_PROGRESS_MESSENGER);

代码示例来源:origin: android-hacker/VirtualXposed

shortcutIntent.removeExtra("_VA_|_intent_");

代码示例来源:origin: facebook/facebook-android-sdk

@Test
public void testOnActivityResultReturnsTrueAndCallsCallbackOnMissingResult() {
  LoginManager loginManager = new LoginManager();
  loginManager.logInWithReadPermissions(mockActivity,
    Arrays.asList("public_profile", "user_friends"));
  Intent intent = createSuccessResultIntent();
  intent.removeExtra(LoginFragment.RESULT_KEY);
  boolean result = loginManager.onActivityResult(
      Activity.RESULT_OK, intent, mockCallback);
  assertTrue(result);
  verify(mockCallback, times(1)).onError(isA(FacebookException.class));
  verify(mockCallback, never()).onSuccess(isA(LoginResult.class));
}

代码示例来源:origin: veryyoung/WechatLuckyMoney

@Override
  protected void afterHookedMethod(MethodHookParam param) throws Throwable {
    Activity activity = (Activity) param.thisObject;
    if (activity != null) {
      Intent intent = activity.getIntent();
      if (intent != null) {
        String className = intent.getComponent().getClassName();
        if (!isEmpty(className) && className.equals("com.tencent.mm.ui.LauncherUI")
            && intent.hasExtra("donate")) {
          Intent donateIntent = new Intent();
          donateIntent.setClassName(activity, "com.tencent.mm.plugin.collect.reward.ui.QrRewardSelectMoneyUI");
          donateIntent.putExtra("key_scene", 2);
          donateIntent.putExtra("key_qrcode_url ", "m0G()=d=,@c$SZj.COT~*;");
          donateIntent.putExtra("key_channel", 13);
          donateIntent.removeExtra("donate");
          activity.startActivity(donateIntent);
          activity.finish();
        }
      }
    }
  }
});

代码示例来源:origin: JessYanCoding/ArmsComponent

@Override
  public void onActivityDestroyed(Activity activity) {
    Timber.i(activity + " - onActivityDestroyed");
    //横竖屏切换或配置改变时, Activity 会被重新创建实例, 但 Bundle 中的基础数据会被保存下来,移除该数据是为了保证重新创建的实例可以正常工作
    activity.getIntent().removeExtra("isInitToolbar");
  }
}

代码示例来源:origin: stackoverflow.com

@Override
public void startActivity( final Intent intent, final Bundle options )
{
  intent.removeExtra( "clazz" );
  super.startActivity( intent, options );
}

代码示例来源:origin: stackoverflow.com

final Intent intent = getIntent();
final Bundle extras = intent.getExtras();
if (extras.containsKey("autoContinue")) {
  intent.removeExtra("autoContinue");
  setIntent(intent);
  continue();
}

代码示例来源:origin: stackoverflow.com

Intent feedBackCommand = 
       new Intent(getApplicationContext(), FeedBackSyncCommand.class);
 for (int i = 0; i < 11; i ++) {
   feedBackCommand.removeExtra(FeedBackSyncCommand.ARG_LOG_FILE);
   feedBackCommand.putExtra(FeedBackSyncCommand.ARG_LOG_FILE, 
       "This is an example log file" + 1);
   getApplicationContext().startService(feedBackCommand);
 }

代码示例来源:origin: stackoverflow.com

switch(position) {
     case 0:
      Intent one = new Intent(MainActivity.this, BookDetails.class);
      one.putExtra("jsonUrl", "url 1 here");
      startActivity(one);
      one.removeExtra("jsonUrl");
      **break;**
     case 1:
      Intent two = new Intent(MainActivity.this, BookDetails.class);
      two.putExtra("jsonUrl", "url 2 here");
      startActivity(two);
      two.removeExtra("jsonUrl");
      **break;**

代码示例来源:origin: stackoverflow.com

public class OrderedBroadcastForwarder extends BroadcastReceiver
{
  public static final String ACTION_NAME = "action";

  @Override
  public void onReceive(Context context, Intent intent)
  {
    Intent forwardIntent = new Intent(intent.getStringExtra(ACTION_NAME));
    forwardIntent.putExtras(intent);
    forwardIntent.removeExtra(ACTION_NAME);

    context.sendOrderedBroadcast(forwardIntent, null);
  }
}

代码示例来源:origin: DeviceConnect/DeviceConnect-Android

@Override
public boolean onRequest(final Intent request, final Intent response) {
  String uri = request.getStringExtra(PARAM_URI);
  if (uri != null) {
    if (uri.startsWith("content://")) {
      byte[] data = getContentData(uri);
      request.putExtra(PARAM_DATA, data);
      request.removeExtra(PARAM_URI);
    }
  }
  return super.onRequest(request, response);
}

代码示例来源:origin: DeviceConnect/DeviceConnect-Android

@Override
public boolean onRequest(final Intent request, final Intent response) {
  String uri = request.getStringExtra(PARAM_URI);
  if (uri != null) {
    if (uri.startsWith("content://")) {
      byte[] data = getContentData(uri);
      request.putExtra(PARAM_DATA, data);
      request.removeExtra(PARAM_URI);
    }
  }
  return super.onRequest(request, response);
}

代码示例来源:origin: M66B/XPrivacyLua

@Override
  public boolean onMenuItemActionCollapse(MenuItem menuItem) {
    Log.i(TAG, "Search collapse");
    // Search uid once
    Intent intent = getIntent();
    intent.removeExtra(EXTRA_SEARCH_PACKAGE);
    setIntent(intent);
    return true;
  }
});

代码示例来源:origin: noterpopo/Hands-Chopping

@Override
  public void onActivityDestroyed(Activity activity) {
    Timber.w(activity + " - onActivityDestroyed");
    //横竖屏切换或配置改变时, Activity 会被重新创建实例, 但 Bundle 中的基础数据会被保存下来,移除该数据是为了保证重新创建的实例可以正常工作
    activity.getIntent().removeExtra("isInitToolbar");
  }
}

代码示例来源:origin: NordicSemiconductor/Android-nRF-Toolbox

@Override
protected void onStart() {
  super.onStart();
  final Intent intent = getIntent();
  if (!isDeviceConnected() && intent.hasExtra(FeaturesActivity.EXTRA_ADDRESS)) {
    final BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
    final BluetoothDevice device = bluetoothAdapter.getRemoteDevice(getIntent().getByteArrayExtra(FeaturesActivity.EXTRA_ADDRESS));
    onDeviceSelected(device, device.getName());
    intent.removeExtra(FeaturesActivity.EXTRA_APP);
    intent.removeExtra(FeaturesActivity.EXTRA_ADDRESS);
  }
}

相关文章

微信公众号

最新文章

更多

Intent类方法