Looking for an example of using state with a custom control

by dm1973 » Sat, 14 Mar 2009 15:55:52 GMT

Sponsored Links
 I am writing a custom widget and would like to use   setState and the
like to handle the focus and pressed states. Is there any sample code
explaining how to do this?

Other Threads

1. How do I start and stop GPS through program to save power?

Apps can't change that setting any more in recent versions of Android.
Well they still can in some rare circumstances, I think, like some
rooted phones.

In recent versions of Android just passing a large value for the
minTime parameter of the LocationManager#requestLocationUpdates will
do what you want automatically anyway. The GPS system will start, stay
up for a few fixes, then shutdown and set an alarm for when it should
start up again based on the minTime you passed.

Other apps may be registered for updates as well, however, which can
keep the GPS on, or make it come on more frequently. You can see
details in this thread:

2. i was beaten by AudioRecord :-(

after i upgraded SDK from 1.5r2 to 1.6, i found a serious problem:

1). on emulator 1.6, my app using AudioRecord records at a
significantly "faster" pace than on 1.5 emulator.

for example, after 30 seconds of audio recording (8kHz/mono) on 1.6
emulator, my app records 340,800 samples, which is equivalent to
348000/8000 = 42 secs of voice. playing back these samples at 8kHz
sounds obviously like slowed down "spacewalks" on the moon.

originally on 1.5 emulator, the same app recorded correctly 240,000

2). on my G1 phone, the same app built with SDK 1.6  records and plays
back audio frames correctly.

originally with SDK 1.5, the same app code always lost 5-10 secs of
voice frames after 30secs of recording, because the recorder seemed to
run out of G1 cpu power, which made AudioRecord.read() unable to read
off recorded frames *in time*.

though my app seems to run on G1 phone with my satisfaction, i am
confused with the weird and inconsistent behavior of AudioRecord class
described above.

could any Android fork or anyone who is knowledgeable of this issue
shed some light to me, telling how i can let AudioRecord sample voice
frames at identical paces on G1 and emulator?

thanks a lot in advance !!!!


3. about the operations on emulator

4. Buzz map -> Anggia Dyarini wants to share their location with you on Google Latitude

5. Google Nexus One Update ROM official dari Google

6. Help mau unroot malah ngaco :(

7. Is wav frequency adjustable?