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. Emualator fails at Boot up

Hi Bryne
Hi All
I was trying to change the kernel for Emulator.I was successful in building
the kernel Image(2.6.27) for the Emlator using the Goldfish configuraton.
The Emulators kernel is booting up however it stops in the intial Andriod
screen. i gave the following command

emulator -kernel ./x/y/zImage -system ./a/b/ -show-kernel

I saw the kernel messages.. Everything works fine; the init finally fails
telling this

init: cannot open '/initlogo.rle'
init: Unable to open persistent property directory /data/property errno: 2
init: cannot find '/system/bin/servicemanager', disabling 'servicemanager'
init: cannot find '/system/bin/mountd', disabling 'mountd'
init: cannot find '/system/bin/de{*filter*}d', disabling 'de{*filter*}d'
init: cannot find '/system/bin/rild', disabling 'ril-daemon'
init: cannot find '/system/bin/app_process', disabling 'zygote'
init: cannot find '/system/bin/mediaserver', disabling 'media'
init: cannot find '/system/bin/playmp3', disabling 'bootsound'
init: cannot find '/system/bin/dbus-daemon', disabling 'dbus'
init: cannot find '/system/bin/installd', disabling 'installd'
init: cannot find '/system/bin/flash_image', disabling 'flash_recovery'
init: cannot find '/system/etc/init.goldfish.sh', disabling 'goldfish-setup'
init: cannot find '/system/bin/qemud', disabling 'qemud'
init: cannot find '/system/bin/logcat', disabling 'goldfish-logcat'

 Does any body face the same problem ??
Joe

--~--~---------~--~----~------------~-------~--~----~

2. Developing an IMS client on Android : Request for Comments.

HiI've been reading this thread and was curious... what kind of
functionality could be achieved with an IMS client running on Android?  I
just can't seem to get my head around it.

In my experience IMS is implemented by the network operator (as an example,
maybe like a Digital Phone service that's offered here in the US by cable
companies)... so if we had this IMS client on an Android phone, what purpose
is served?  The network operator would have to support it, right?

Would like to hear what the application of IMS is for Android.
















--~--~---------~--~----~------------~-------~--~----~

3. System log buffer size

4. adb push (Read only file system)

5. Is it possible to retrieve a list of resource ids

6. crash in com.android.camera after calling Images.Media.insertImage

7. Developing an IMS client on Android : Request for comments.