Skip to content

Instantly share code, notes, and snippets.

@orhanobut
Last active September 23, 2015 07:33
Show Gist options
  • Save orhanobut/26d1d7142057ba5f90b3 to your computer and use it in GitHub Desktop.
Save orhanobut/26d1d7142057ba5f90b3 to your computer and use it in GitHub Desktop.
// sends the data
public class LoginActivity extends Activity {
void displayHome() {
Intent intent = new Intent(this, HomeActivity.class);
intent.putExtra(HomeActivity.KEY_USER, user);
startActivity(intent);
}
}
// gets the data
public class HomeActivity extends Activity {
public static final String KEY_USER = "KEY_USER";
@Override public void onCreate(Bundle bundle) {
String user = getIntent.getStringExtra(KEY_USER);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment