How do you pass data/parameters to another activity in Android
How to pass data/parameter values from one activity to another in android?
I have used
loginname=txtloginname.getText().toString();
passwo开发者_如何学Pythonrd=txtpassword.getText().toString();
Bundle bundle = new Bundle();
bundle.putString("loginname", loginname);
bundle.putString("password", password);
Intent newIntent=new Intent();
newIntent.putExtras(bundle);
setResult(RESULT_OK,newIntent);
finish();
But I can only get loginname value How to put both login and password key and value?
You can just say newIntent.putExtra("name",value);
use it multiple times to add multiple data. And depending on the data you stored call getStringExtra("name");
in the next activity.
You can use the method:
getStringExtra()
精彩评论