I am quite new to Android and facing a problem.
I have a class A from where i would like to call another activity. I have found some post saying that there is no way to pause the calling Activity and wait for the result.
public class A extends AppCompatActivity {
[...]
private List<String> list = new ArrayList<String>();
private void doSomething() {
list.add("a");
list.add("b");
for(String tmp:list) {
Intent intent = new Intent(this, OtherActivity.class);
intent.putStringExtra("TAG", tmp);
startActivityForResult(intent, 1);
}
}
This is not a complete example but basically the problem I am facing.
I have a loop and try to open another activity. The loop does not stop when i start the "OtherActivity". The first thing i see is the OtherActivity for the last element of the list (here String "b"). When i finish this Activity i see the OtherActivity with String "a" in wrong order.
I considered a callback for this, but i am not sure how to implement it because the callback handler wouldn't be within the loop.
Again I am not sure if a callback would be a good idea because many people say i should not Pause the "calling" activity for the sub activity.