1) Use the Bundle from the Intent:
Intent mIntent = new Intent(this, Example.class);
Bundle extras = mIntent.getExtras();
extras.putString(key, value);
2) Create a new BundleIntent mIntent = new Intent(this, Example.class);
Bundle mBundle = new Bundle();
mBundle.extras.putString(key, value);
mIntent.putExtras(mBundle);
3) Use the putExtra() shortcut method of the IntentIntent mIntent = new Intent(this, Example.class);
mIntent.putExtra(key, value);
Getting Value in naother activity
Bundle bundle =
this
.getIntent().getExtras();
if
(bundle !=
null
) {
String strdata = bundle.getString(
"senddata"
);
}
Realy good post
ReplyDelete