On Sunday, 8 July 2012 03:14:22 UTC+1, yamanoorsai wrote:
> Hi,
>
> </div>
> 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.</div>
>
> </div>
> This is the function that reads the string in the runnable:</div>
>
>
>
You could put the string into a Preference variable and read it back in the
runnable.
> </div>
> <blockquote class="gmail_quote" style="margin:0px 0px 0px
> 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span
> style="white-space:pre"> </span>public void Message(String Message)
>
>
> <span style="white-space:pre"> </span>{
> <span style="white-space:pre"> </span> String r = Message;
> <span style="white-space:pre"> </span> try {
>
>
> <span style="white-space:pre"> </span> myNum =
> Integer.parseInt(r);
> <span style="white-space:pre"> </span> }
> catch(NumberFormatException nfe) {
> <span style="white-space:pre"> </span> }
>
>
> <span style="white-space:pre"> </span> m = (myNum/100);
> <span style="white-space:pre"> </span> if(m>=8)
> <span style="white-space:pre"> </span> {
>
>
> <span style="white-space:pre"> </span> m=1;
> <span style="white-space:pre"> </span> }
> <span style="white-space:pre"> </span>}</blockquote></div>
>
>
>
> </div>
> This is how I am calling the runnable in the main activity: </div>
>
> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px
> 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
>
> pBar.Message(message). </blockquote>
>
> </div>
> 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.</div>
>
>
>
> </div>
>
> </div>
> Sai</div>
--
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