[Solved] How can I get integer value from activity-launcher to activity-default


To pass values from your “LauncherActivity:”

Intent i = new Intent(getApplicationContext(), DefaultActivity.class);
i.putExtra("cycles",5);
startActivity(i);

Then retrieve those values in the “DefaultActivity”:

Bundle extras = getIntent().getExtras();
int cycles = 0;
if (extras != null) {
    cycles = extras.getInt("cycles");
}
for (int i = 0; i < cycles: i++) {
    //do stuff
}

1

solved How can I get integer value from activity-launcher to activity-default