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. Talking to service Daemons / init.rc help

We figured our issue was that the daemon service was not declared in
init.rc.  We added it there but that has just made it worse. When the
sdio device is plugged in it can no longer see the daemon.  Before
when we ran the daemon from command line the sdio device could connect
but the JNI calls could not connect.  Now neither can connect.

We added the following to init.rc
service wimax /system/bin/wimaxd -b -i wmx0
    socket wimax stream 660

Can anyone tell me explicitly what the user and group are used for. Do
we have to define user and group somewhere else? I've tried a variety
of different user/group settings and none at all but nothing seems to
work. I've read the readme.txt but there isn't much info specifically
about the user/group settings.







> > > website:

2. Selectively start a service based on type of build

Anyone know of a simple way to selectively start a service based of
the type of build (USER, USERDEBUG, ENG) ? So, for example, I would
like to start a service using "logwrapper" in the USERDEBUG/ENG build
and without it in the USER build.

Example:
In USERDEBUG/ENG build:
service my-service /system/bin/logwrapper /system/bin/test

In USER builds:
service my-service /system/bin/test

Thanks,
Vijay

-- 
unsubscribe: android-porting+unsubscr...@googlegroups.com
website: 

3. When a phone is factory reset, market loses track of purchased apps

4. Offering App Design Services

5. CameraSurfaceView and how surfaceCreated() gets called - Can someone please help me?

6. CameraSurfaceView and how surfaceCreated() gets called - Can someone please help me?

7. SoundPool still crashing on 1.5, 1.6 and maybe 2.0