sensors HAL

by Ken Schultz » Thu, 05 Mar 2009 18:22:18 GMT

Sponsored Links
 Is there a recommended way to pass information between a
sensors_control_context_t struct and a sensors_data_context_t struct?
(i.e. active_sensors)  For devices without a hardware eCompass there
needs to be a way in the polling function to determine if the sensor
is activated, so it can inject data.  The polling function is part of
the sensors_data_context_t and the activate function is part of



Other Threads

1. Setting and testing state of WiFi Tether hotspot setting in 2.2

I am wanting to programmaticaly set the state of the enable flag for
WiFi Hotspot Tethering in
Froyo. Something like this:

                boolean isEnabled =
                                Settings.System.SOME_WIFI_TETHER_FLAG, 0) == 1;

                  // toggle HOTSPOT mode
isEnabled ? 0 : 1);

                  // Post an intent to reload
                Intent intent = new 
                intent.putExtra("state", !isEnabled);

Is there a programmatic flag for turning off wifi hotspot mode in 2.2
from Settings.System class?

Thanks in advance



2. Bitmaps and OutOfMemoryError: Best Practices needed

I'm running into OutOfMemoryErrors when allocating bitmaps. This is
not something I can reproduce with emulators, and has been reported by
a few beta testers with the HTC Incredible.

I'm not sure I can solve this directly, and my best hope is to follow
best practices for bitmaps and memory thereof. But looking for those
best practices based on groups archives left me with more questions
than answers. If anyone has a chapter about this in their book, I will
buy the book.

Here are the things I've mulled over so far:

1. I have a bitmap for a drawing buffer. It is about 3-4 megabytes on
some devices. This is the biggest bitmap I have, and without it, I
wouldn't be able to much of anything useful in my app.  I am assuming
that it would not be useful to use inPurgeable if this is a bitmap
that is drawn into. Is this true?

2. Next biggest in the hierarchy are some bitmaps that are about 22K
bytes and 256K unpacked.  Since I believe about 25 of these might be
used at one time, I have a cache with a size of 25.
I am careful to use BitmapFactory.Options.InPurgeable, so I believe
that could make them take only 22K each, but I don't see that as
guaranteed. Maybe they are taking 256K each, which would put me in the
danger zone.
As they are cycled out of the cache, I call bitmap.recycle(). I think
this a good practice. Is it?

3. Next are some resources with icon size 32x32 pixels.  There are
about 50 that could be used or reused. If I use code like this:

                                                Drawable s =
Where s is a local variable to rendering. Suppose I call this 37
Am I to assume that Android will do something smart like create only
one bitmap for this resource even if it is used 37 times?
Or am I to assume that Android will do something stupid like create 37
bitmaps and keep references in an obscure location that will prevent
garbage collection?
Do I need to get more access to these bitmaps and do something smart

4. Finally are some other icons used for menus and ImageButtons. Most
are declared in layout files - so I don't touch the bitmaps directly.

Can someone better informed than me comment on these assumptions? I'd
like to make my memory usage more efficient, but don't want to spend
time on things that will amount to shuffling chairs on the Titanic.

And how do I best measure this usage? Interestingly enough, I've tried
using the Allocation Tracker and it says I haven't allocated a single
bitmap. In light of the above, I don't think that's right.

Thanks in advance.



3. Replacing Contact Application with new Contact application

4. Finish an activity not started from the service

5. GPS fix status detection

6. O2 APN settings

7. Transparency with 2 .jpg files