Saturday, October 1, 2011

[android-developers] sendMessage and handleMessage

Hello.

Iam having some trouble sending message from a thread back to the
"main" thread.

I just need to send a integer just so i know what just happend in the
thread.

This is what i use right now,

Message msg = Message.obtain();
msg.what = 1;
progressHandler.sendMessage(msg);

- - - - -

private Handler progressHandler = new Handler() {
@Override
public void handleMessage(Message msg) {

Toast.makeText(getApplicationContext(), msg.toString(),
Toast.LENGTH_LONG).show();

This will show me:
{ what=1 when=somenumbers }

Is there a way so i just could "grabb" the Int 1 in this case?

Iam then going to build if statments depends on the integer


--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate