1

i will be targeting my app to all the android devices, what is the best way of doing it? so far i will be targeting Android phone and Kindle-fire and here is my thoughts.

android phone and its working as expected with images,font size etc... so i thought to test my app for kindle-fire:

create AVD emulator for kindle-fire with the below specification but i have few problems testing on the kindle-fire:

  1. the images are stretched out (not sure if the images size should be increased for kindle-fire?)
  2. font size is smaller then android phone (which i have tested)
  3. i have no back button in my activity so i assume the user will be able to use the back arrow button in kindle-fire but in the emulator there is none showing.

Here are the specs of the Kindle Fire

  • Width: 600px
  • Height: 1024px
  • Abstracted LCD Density: 169
  • Target: Android 2.3.3 - API Level 10
  • RAM: 512 MB

what do i need to do in order to look and feel on both android phone and amazon kindle-fire?

should i create two separate projects and target font-size and image-size?

i am not sure what else i need to consider.

slayton
  • 20,123
  • 10
  • 60
  • 89
Nick Kahn
  • 19,652
  • 91
  • 275
  • 406
  • 1
    http://stackoverflow.com/questions/8258376/best-practices-to-use-when-targeting-multiple-screen-resolutions-on-android – slayton Apr 05 '12 at 17:22

2 Answers2

0

For the font, be sure to use the sp unit of measurement.

For the images, you can store them in different folders and name the folder using different attributes.

http://developer.android.com/guide/topics/resources/providing-resources.html

I will say though, I had a difficult time differentiating between the kindle and my 10 inch tablets, because they are both judged to be large by android. So I just created different layout for them and checked for screen size in the onCreate. Here is the code.

Display display = ((WindowManager)getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
if(display.getWidth() <= 600 || display.getHeight() <= 600) 
{
    this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
    setContentView(R.layout.kindle_fire_layout);
} 
else 
{       
    setContentView(R.layout.anything_else);     
}
Msonic
  • 1,456
  • 15
  • 25
mac10688
  • 2,145
  • 2
  • 24
  • 37
0

To test on the emulator, use the code bellow to avoid android recognizing it as a xlarge device. Then you can put your resources where they should be. Also keep in mind the the kindle fire ui takes some pixels off the view for the bar, etc, so you might want to also consider that

final Configuration config = new Configuration(context.getResources().getConfiguration()); 
config.screenLayout = (config.screenLayout & Configuration.SCREENLAYOUT_LONG_MASK) + Configuration.SCREENLAYOUT_SIZE_LARGE; 
context.getResources().updateConfiguration(context.getResources().getConfiguration(), context.getResources().getDisplayMetrics());