How to force main Acivity to wait for subactivity in Android?
Posted
by rmaster
on Stack Overflow
See other posts from Stack Overflow
or by rmaster
Published on 2010-05-21T06:13:07Z
Indexed on
2010/05/21
6:20 UTC
Read the original article
Hit count: 197
hi, I am calling a subactivity from main activity. This subactivity should take few numbers from user (i'm using Edit text control to achieve this), save them to static variable in another class and terminate. I want main activity to wait for subactivity but both are just running simultaneously. Even doing sth like that doesn't help:
Thread t = new Thread(new Runnable(){
public void run(){
Log.v("==================", "run "+new Date());
startActivityForResult(new Intent(ctx,myCustomSubactivity.class),1);
} });
Log.v("==================", "calling run "+new Date());
t.start();
try {
t.join();
} catch (InterruptedException e) {Log.v("==================", "can't join");}
Log.v("==================", "back from activity "+new Date());
do you know how to force main activity to wait? Thread.wait() method is not supported in Android(program throws error).
© Stack Overflow or respective owner