Skip to content

Instantly share code, notes, and snippets.

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