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. Anyone updating their app recently notice unexpected drop in install percentage?


This happened once before in December 2009. When I released an update
on Friday, my install percentage dropped about 6%.
My install percentage usually goes up when I release an update. Anyone
notice something similar? I'm wondering if it is a problem
with the market stats?




2. Open-Source Repository


I'm re-opening the JVending project, which has been inactive (publicly) for
a couple of years. There has been some chatter from individuals interested
in an open-source repository for Android so I think it will be a good start.
You can basically think of it as an Android delivery system where you can
filter and deliver content based on type of device. For example filtering
out Android 2.1+ content for Android 1.5 devices. Things like matching rules
and device profiles are configured through configurations files. You can
plugin specialized delivery adapters if you have specialized content to
deliver to the Android device.

It also handles localization, versioning of apps, variations, etc.

JVending is the building block for a larger system so this project is really
for developers who can dive in and customize the front-end and/or back-end
services that they need. If you want to donate some front-end web
functionality (or anything else), I'll add it to the core project. I'll also
be hosting a dev version for people to try out the latest build changes. I
can also see putting up a production server for open-source android apps at
some point.

Some changes in the project:

1) Moving the license from LGPL to ASL2.
2) I've refactored the code collapsing a number of modules
3) Significant performance optimizations in Hibernate
4) Android Events Database

In the upcoming commit, I'm also hemorrhaging a number of archaic aspects of
JVending like the provisioning archive and stocking api, which made sense 8
years ago but with the size of applications growing significantly (a 300KB
application at that time was considered huge, most were 50-60KB), these
things don't make sense. So I'll be moving away from the JSR-124 spec toward
something more appropriate to today's mobile environment.

I still need to add a module for the webservice itself, which will be out
shortly, but feel free to dive in.


I've also opened up the* jam *project (JVending Application Manager), which
will be an open-source download and discovery manager. A lot of people have
been interested in this part of the project.


I'm not putting any code out there yet till things like the feeds go up in
the webservice. Once the community decides what the feeds to the mobile
client should look like, we can build out the client. For SlideME, I had a
simple, custom format for the feeds, but am thinking to use JSON or
something similar to standardize it.

Feel free to open any issues on github, submit patches, follow, make
comments, etc. After a few good patches, I usually offer people to become a
committer on the project.

Shane Isbell (Founder of ZappMarket)


3. Home button in Beagle board

4. WebGL and O3D on DroidX

5. Fwd: copybit format conversion issue, for help

6. Changing from one dev machine to another, keystore question

7. kernel panic at keyguard screen