Hi everybody,

I do not understand well the concept behind the Handler.

I want to launch a Toaster (or a dialogActivity) from a thread, to be
displayed in the main UI of my application. Here is my code:

      // IN MY ACTIVITY :
                      Handler handler = new Handler();
                      Thread thread = new SmsishingUtils(this,
handler);
                      thread.start();

                      String warning = handler.obtainMessage().getData
().getString("warning");.
                      Toast.makeText(this, warning,
Toast.LENGTH_SHORT).show();

      // IN MY THREAD :
                          Bundle data = new Bundle();
                          data.putString("warning", warning);
                          Message msg = new Message();
                          msg.setData(data);
                          handler.sendMessage(msg);

Obviously this code doesn't work and no Toast is displayed. Any tips
or suggestion?

Thank you for your help,
Deniz
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" 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-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to