- Create a New Explicit or Implicit Intent object in source activity.
- Call intent.putExtra(String key, Object data) method to save data in it.
- Call startActivity(intent) method in source activity to pass the intent to android os.
- Call getIntent() method in target activity.
- Use intent.getStringExtra(String key) to get the transferred data.
This-
Intent intent = new Intent(this, BasicViewsActivity.class); intent.putExtra("amountTime", String.valueOf(amountTime)); startActivity(intent);
BasicViewActivity-
Intent intent = getIntent(); String amountTime = intent.getStringExtra("amountTime");
https://www.dev2qa.com/passing-data-between-activities-android-tutorial/
No hay comentarios:
Publicar un comentario