Hi guys,
I have this situation :
[Main.java]
public class Main extends Activity {
public static Handler handler;
public static ProgressDialog pd;
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setTheme(android.R.style.Theme);
handler = new Handler();
....etc.....etc.....
Myclass myobj = new Myclass();
[MyClass.java]
public class Myclass implements Runnable{
//private ProgressDialog pd;
//private Handler handler;
public Myclass(){
Main.pd = ProgressDialog.show(_ctx, "Working", "Calculating...",
true, false);
Thread thread = new Thread(this);
thread.start();
}
public void run() {
// Do something.........
Main.handler.post(new Runnable() {
public void run() {
Main.pd.dismiss();
}
});
}
And I have this error : "Can't create handler inside thread that has not
called Looper.prepare()"
I try to insert Looper.prepare() at the first of run() method, but my
program doesn't work. Why?
Can anyone help me?
Thanks,
Francesco
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---