First activity
Intent i = new Intent(getApplicationContext(), NewActivity.class);
i.putExtra("new_variable_name","value");
startActivity(i);
in new activity
Bundle extras = getIntent().getExtras();
if (extras != null) {
String value = extras.getString("new_variable_name");
}
Send value
Intent i = new Intent(getBaseContext(), PlayActivity.class);
ActivityOptions options = ActivityOptions.makeCustomAnimation(Story1Activity.this, R.anim.fade_in, R.anim.fade_out);
i.putExtra(carryLoginstatus,loginStatus);
startActivity(i, options.toBundle());
Retrieve value
Intent gameoverIntent = getIntent();
String scoreCount = gameoverIntent.getStringExtra(PlayActivity.finalScore);
No comments:
Post a Comment