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

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

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

Intent.putExtras介绍

暂无

代码示例

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

Intent mIntent = new Intent(this, Example.class);
Bundle mBundle = new Bundle();
mBundle.putString(key, value);
mIntent.putExtras(mBundle);

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

Bundle b=new Bundle();
b.putStringArray(key, new String[]{value1, value2});
Intent i=new Intent(context, Class);
i.putExtras(b);

代码示例来源:origin: HotBitmapGG/bilibili-android-client

public static void launch(Activity activity, RegionTypesInfo.DataBean dataBean) {
  Intent mIntent = new Intent(activity, RegionTypeDetailsActivity.class);
  Bundle bundle = new Bundle();
  bundle.putParcelable(ConstantUtil.EXTRA_PARTITION, dataBean);
  mIntent.putExtras(bundle);
  activity.startActivity(mIntent);
}

代码示例来源:origin: naman14/Timber

public void updateService(Bundle extras) {
  if(!MusicPlayer.isPlaybackServiceConnected())return;
  final Intent intent = new Intent(context, MusicService.class);
  intent.setAction(MusicService.UPDATE_PREFERENCES);
  intent.putExtras(extras);
  context.startService(intent);
}

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

Bundle bridgeArguments = new Bundle();
  bridgeArguments.putString(BRIDGE_ARG_ACTION_ID_STRING, callId);
  Utility.putNonEmptyString(bridgeArguments, BRIDGE_ARG_APP_NAME_STRING, applicationName);
  Bundle methodArguments = (params == null) ? new Bundle() : params;
  intent.putExtra(EXTRA_PROTOCOL_METHOD_ARGS, methodArguments);
} else {
    intent.putExtra(EXTRA_APPLICATION_NAME, applicationName);
  intent.putExtras(params);

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

Intent intent = new Intent(first.this, second.class);

Bundle bundle = new Bundle();
bundle.putInt("index", index);

intent.putExtras(bundle);startActivity(intent);

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

Intent intent = new Intent(getApplicationContext(),YourActivity.class);
Bundle bundle = new Bundle();
bundle.putParcelable("data", sharedBookingObject);
intent.putExtras(bundle);
startActivity(intent);

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

@Override
public void onBackPressed() {
  Bundle bundle = new Bundle();
  bundle.putString(FIELD_A, mA.getText().toString());

  Intent mIntent = new Intent();
  mIntent.putExtras(bundle);
  setResult(RESULT_OK, mIntent);
  super.onBackPressed();
}

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

CustomListing currentListing = new CustomListing();
Intent i = new Intent();
Bundle b = new Bundle();
b.putParcelable(Constants.CUSTOM_LISTING, currentListing);
i.putExtras(b);
i.setClass(this, SearchDetailsActivity.class);
startActivity(i);

代码示例来源:origin: chentao0707/SimplifyReader

/**
 * startActivity with bundle
 *
 * @param clazz
 * @param bundle
 */
protected void readyGo(Class<?> clazz, Bundle bundle) {
  Intent intent = new Intent(this, clazz);
  if (null != bundle) {
    intent.putExtras(bundle);
  }
  startActivity(intent);
}

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

Intent intent = new Intent(BROADCAST);  
   Bundle extras = new Bundle();  
   extras.putString("send_data", "test");  
   intent.putExtras(extras);  
   sendBroadcast(intent);

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

sendButton.setOnClickListener(new OnClickListener() {
   public void onClick(View v) {
     String valueString = editValue.getText().toString();
     long value;
     if (valueString != null) {
       value = Long.parseLong(valueString);
     }
     else {
       value = 0;
     }
     Bundle sendBundle = new Bundle();
     sendBundle.putLong("value", value);
     Intent i = new Intent(Activity1.this, Activity2.class);
     i.putExtras(sendBundle);
     startActivity(i);
     finish();
   }
 });

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

Bundle b=new Bundle();
b.putStringArray(key, new String[]{value1, value2});
Intent i=new Intent(context, Class);
i.putExtras(b);

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

Intent intent = new Intent(this, MyActivity.class);
Bundle extras = new Bundle();
extras.putString("EXTRA_USERNAME","my_username");
extras.putString("EXTRA_PASSWORD","my_password");
intent.putExtras(extras);
startActivity(intent);

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

@Override
public void onBackPressed() {

  Intent data = new Intent();
  Bundle bundle = new Bundle();

  bundle.putParcelable("name", la);
  data.putExtras(bundle);

  if (getParent() == null) {
    setResult(Activity.RESULT_OK, data);
  } else {
    getParent().setResult(Activity.RESULT_OK, data);
  }

  super.onBackPressed();
}

代码示例来源:origin: chentao0707/SimplifyReader

/**
 * startActivity with bundle
 *
 * @param clazz
 * @param bundle
 */
protected void readyGo(Class<?> clazz, Bundle bundle) {
  Intent intent = new Intent(this, clazz);
  if (null != bundle) {
    intent.putExtras(bundle);
  }
  startActivity(intent);
}

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

Bundle bundle = new Bundle();
bundle.putString("name", "Android");
bundle.putString("iname", "iPhone");
Intent intent = new Intent(getApplicationContext(), MyActivity.class);
intent.putExtras(bundle);
startActivity(intent);

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

private void sendSuggestionIntent(ResultItem item) {
  try {
    Intent sendIntent = new Intent(this, Class.forName(searchableActivity));
    sendIntent.setAction(Intent.ACTION_VIEW);
    sendIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);

    Bundle b = new Bundle();
    b.putParcelable(CustomSearchableConstants.CLICKED_RESULT_ITEM, item);

    sendIntent.putExtras(b);
    startActivity(sendIntent);
    finish();
  } catch (ClassNotFoundException e) {
    e.printStackTrace();
  }
}

代码示例来源:origin: HotBitmapGG/bilibili-android-client

public static void launch(Activity activity, int seasonId) {
    Intent mIntent = new Intent(activity, BangumiDetailsActivity.class);
    Bundle bundle = new Bundle();
    bundle.putInt(ConstantUtil.EXTRA_BANGUMI_KEY, seasonId);
    mIntent.putExtras(bundle);
    activity.startActivity(mIntent);
  }
}

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

private void onCompleteWebFallbackDialog(Bundle values) {
    FragmentActivity fragmentActivity = getActivity();

    Intent resultIntent = new Intent();
    resultIntent.putExtras(values == null ? new Bundle() : values);

    fragmentActivity.setResult(Activity.RESULT_OK, resultIntent);
    fragmentActivity.finish();
  }
}

相关文章

Intent类方法