Skip to content

Instantly share code, notes, and snippets.

@ageorg
Created December 18, 2016 21:38
Show Gist options
  • Save ageorg/4edfdcc1c673fb2db24c27263d7fdf9b to your computer and use it in GitHub Desktop.
Save ageorg/4edfdcc1c673fb2db24c27263d7fdf9b to your computer and use it in GitHub Desktop.
creating an Intent with extra information
nameEditText = (EditText) findViewById(R.id.editText);
Button nextBtn = (Button) findViewById(R.id.btn_next);
nextBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent i = new Intent(MainActivity.this, Main2Activity.class);
String nameStr = nameEditText.getText().toString();
i.putExtra(TAG_NAME, nameStr);
startActivity(i);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment