Saturday, July 7, 2012

[android-developers] Re: Passing a string to a runnable

I really can't figure out what you are asking here.  There's no evidence or a runnable. I'm guessing that m and myNum are data members?  Are they being updated from two different threads?

G. Blake Meike
Marakana

The second edition of Programming Android is now on-line:
http://shop.oreilly.com/product/0636920023005.do

On Saturday, July 7, 2012 7:14:22 PM UTC-7, yamanoorsai wrote:
Hi,

I have a runnable in my app that runs an animation. I would like to update a variable so that animation varies according to the data from bluetooth.

This is the function that reads the string in the runnable:

public void Message(String Message)
{
   String r = Message;
   try {
       myNum = Integer.parseInt(r);
   } catch(NumberFormatException nfe) {
   }
  m = (myNum/100);
  if(m>=8)
  {
  m=1;
  }
}

This is how I am calling the runnable in the main activity: 

pBar.Message(message). 

It takes at least a minute to update the string in the runnable and it happens only once. I am not able to pass a string to the runnable. Any suggestions to pass a string to a runnable would be greatly appreciated.


Sai

--
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

No comments:

Post a Comment