Screen density & screen layout size

by Chopcsu » Mon, 14 Dec 2009 08:34:51 GMT


Sponsored Links
 Hi,

I am having problems getting Android to use the correct resources.

I am trying to have it pick the correct resources across all densitys
and screen layouts & orientations.

So I have created the directory structure as follows


drawable
drawable-large
drawable-large-land
drawable-large-port
drawable-normal-hdpi
drawable-normal-mdpi
drawable-normal-ldpi
drawable-normal-land-hdpi
drawable-normal-land-mdpi
drawable-normal-land-ldpi
drawable-normal-port-hdpi
drawable-normal-port-mdpi
drawable-normal-port-ldpi
drawable-small
drawable-small-land
drawable-small-port

Since large screen layouts are always hi res screens (480x800,480x848)
and small screen layouts are always lowres(240x320,240x400 etc) i did
not include density descriptions in the directory naming.
And likewise since normal can be low,medium of high resolution
screens, I have included all the different density markers.

I am not sure if android likes me naming the directories like this
since when I load up the normal 320x480 screen,
It is selecting Hi-res resources and down-scaling them. I can see
nowhere in documentation that says this is what it will do so im am
quite confussed as this is what it seems like it is doing.

I am using

 <supports-screens
          android:largeScreens="true"
          android:normalScreens="true"
          android:smallScreens="true"
          android:anyDensity="true" />

Yet I am positive it is resizing the resources automatically for me.
Testing with 2.0 emulators.

When using the WVGA emulators, it uses the hdpi resources unscaled,
when using the 320x480 emulator, it is using the hdpi resources down-
scaled.

Any ideas on where I am going wrong?


--



Other Threads

1. Observation and comments on Android and "regularly" scheduled events

Hi Mark,

THanks for the reply. I use your book as a reference from time to
time. I would recommend it to anyone reading this.

Before I open an issue, I would like to hear from other developers to
see if their experiences have been similar, and if not, do some code
comparison to see what they are doing different. I just want to make
sure this is an issue and not a mistake on my part.

I am willing to post some code if it is needed.







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

2. Understanding LocationListener.

I, like many, have been writing a Service utilizing location (GPS)
data. As this service is spinning/waiting in the background I would
like to requestLocationUpdates when the GPS is enabled and de-register
for the updates when disabled. So, it seemed like the correct place to
do this was in the onProviderDisabled and onProviderEnabled methods of
the LocationListener I specified.

So, long story short is I have logged the number of times these event
are called when the GPS is enabled/disabled via the settings. Below is
a sample log that was generated.

The scenario below is as follows:

1.) The service is started with GPS disabled in the settings.
2.) The GPS is then enabled via settings.

#log4j
INFO - GPS provider is not enabled.
INFO - Created the service.
INFO - Provider enabled: gps
INFO - Provider enabled: gps
INFO - Provider disabled: gps
INFO - Provider disabled: gps
INFO - Provider enabled: gps
INFO - Provider enabled: gps
INFO - Provider disabled: gps
INFO - Provider disabled: gps
INFO - Provider enabled: gps
INFO - Provider enabled: gps
INFO - Provider disabled: gps
INFO - Provider disabled: gps
INFO - Provider enabled: gps
INFO - Provider enabled: gps
INFO - Provider disabled: gps
INFO - Provider disabled: gps
INFO - Provider enabled: gps
INFO - Provider enabled: gps
INFO - Provider disabled: gps
INFO - Provider disabled: gps
INFO - Provider enabled: gps
INFO - Provider enabled: gps
INFO - Provider disabled: gps
INFO - Provider disabled: gps
INFO - Provider enabled: gps
INFO - Provider enabled: gps
INFO - Provider disabled: gps
INFO - Provider disabled: gps
INFO - Provider enabled: gps
INFO - Provider enabled: gps
INFO - Provider disabled: gps
INFO - Provider disabled: gps
INFO - Provider enabled: gps
INFO - Provider enabled: gps
INFO - onStatusChanged: gps Status: 1
INFO - onStatusChanged: gps Status: 1
INFO - onStatusChanged: gps Status: 1
INFO - onStatusChanged: gps Status: 1
INFO - onStatusChanged: gps Status: 1
INFO - onStatusChanged: gps Status: 1
INFO - onStatusChanged: gps Status: 1
INFO - onStatusChanged: gps Status: 1
INFO - onStatusChanged: gps Status: 1
INFO - onStatusChanged: gps Status: 1
INFO - onStatusChanged: gps Status: 1
INFO - onStatusChanged: gps Status: 1
INFO - onStatusChanged: gps Status: 2
INFO - onStatusChanged: gps Status: 2
INFO - onStatusChanged: gps Status: 2
INFO - onStatusChanged: gps Status: 2
INFO - onStatusChanged: gps Status: 2
INFO - onStatusChanged: gps Status: 2
INFO - onStatusChanged: gps Status: 2
INFO - onStatusChanged: gps Status: 2
INFO - onStatusChanged: gps Status: 2
INFO - onStatusChanged: gps Status: 2

For clarification:

The lines "INFO - Provider enabled: gps" are generated via the
onProviderEnabled method, showing the provider string.
The lines "INFO - Provider disabled: gps" are generated via the
onProviderDisabled method.
The lines "INFO - onStatusChanged: gps Status: 1" are generated via
the onStatusChanged, showing the status int.

So, any ideas why these methods are called so many times. Why is
onProviderDisabled called when the GPS is clearly enabled? Is there a
more appropriate place to register/de-register for location updates?

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

3. Looking for a few co developers

4. What is the best way to sent/receive data from remote database such as mysql on android?

5. scale a view

6. Displaying a Class Variable on Screen

7. ANDROID_PROPERTY_WORKSPACE