Friday, 19 July 2013

Passing Values from one page to other page in android

Passing Values from  one activity to other activity in android


Use Bundle to accomplish this task





1st activity
final Bundle bundle = new Bundle();
bundle.putString("data", name);
i.putExtras(bundle);  //before starting 2nd activity  i.e startActivity(i);

2nd Activity
final Bundle bundle = new Bundle();
Bundle bundle = getIntent().getExtras();
  String name = bundle.getString("data");

No comments:

Post a Comment