A timer thread and url fetch thread in same activity.

by Droid » Fri, 20 May 2011 04:57:45 GMT


Sponsored Links
 I am having problems with a timer that should fetch http results from
the web every 5 minutes.
I having problems with two threads - often I cannot even turn them off
or keep the timer going without upsetting the apple cart.

Should I start using wait() and notify(), a separate service or
continue trying to get them to be friends with each other in the same
activity. At present its all very badly behaved and I feel as though I
am juggling with marbles.

-- 



Re: A timer thread and url fetch thread in same activity.

by TreKing » Fri, 20 May 2011 05:06:37 GMT


 



Just saying you're using two threads is a red flag. What apple cart?



Use a handler to schedule a message to go off in 5 minutes. When that
message is delivered, use an AsyncTask to do the fetch and handle the
results when it completes.

No raw threads necessary.

-------------------------------------------------------------------------------------------------
TreKing < http://sites.google.com/site/rezmobileapps/treking> ; - Chicago
transit tracking app for Android-powered devices

-- 


Sponsored Links


Other Threads

1. Adding Rate this application capability

Hi All,

I have seen few android applications in which there is a capability
where they can give an option in the application itself to "Grade this
application".

Clicking on this option opens the respective application's page in the
android market where the user can put his rating.

I wan to know how this is achieved. I also want to give this feature
in my application.

Thanks & Best Regards
Amit

-- 

2. Headless emulator

Hi all,

I didn't find much on this anywhere and I have a feeling it is not
really possible but just in case - is there a way to launch the
emulator remotely without the necessary GUI (I can do that
using VNC etc. but it turns out to be too slow) and install/launch
apps on it?

Thanks

-- 

3. Proximity alerts not fired

4. setselection() doesn't have visual effect

5. Problem debugging Android Bootup Service

6. Application without main activity

7. Listview problems