Hi,
We are having some problems showing a ProgressDialog on a onCreate
method (for example, when the app calculates some operations before
starts).
This is a example of what is our problem:
public class dialog extends Activity {
/** Called when the activity is first created. */
int res;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
TextView tv = (TextView) findViewByID(R.layout.textv);
final ProgressDialog pd = ProgressDialog.show(this, "Title",
"Message",
true, false);
new Thread(new Runnable() {
public void run() {
try {
res = 2+2;
Thread.sleep(1000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
pd.dismiss();
}
}).start();
tv.setText(res);
}
}
We cant do the tv.setText in the thread because it throws an
Exception. The problem is the dialog doenst appear until the Thread is
finished,
Any help?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---