-1

I have developed an application for Android Smartphones (including 7 inch tablets and Notes) , i forced the application to be run in vertical (by AndroidManifest.Xml)

Now i want to develop the same application for tablets ( specially for 10.1 inches) :

  1. it will be the same APK , or its better to Create another APK ?
    1. Is there anyway to find if device is tablet or not? (size of screen or something)
    2. if it will be same APK , how can i force the app to stick on Vertical for Smartphones and stick on Horizontal for Tablets? ( Meaning if app is running on tablets it will never rotate to vertical and vice versa for smartphones )
    3. how can i define layouts for horizontal ?!
    4. if anyone got special experience on doing this please share it with me
devOp
  • 3,150
  • 1
  • 18
  • 32
Mahdi Giveie
  • 630
  • 1
  • 8
  • 25
  • 2
    refer this http://developer.android.com/guide/practices/screens_support.html#screen-independence. you can create different layout for different screens i.e layout for 10.1 tablet will go in `layout-xlarge-land` folder – Juned Jan 03 '13 at 13:37
  • 1
    hi.. developing app for big size devices wont require another apk file.. we have to create it using the same app. but the thing is you have to learn some basic concepts for how to give support for multiple screens. like background images etc.. and also you can create a various layout files for small sizes.. and for landscape.. and portrait and large .. etc.. – itsrajesh4uguys Jan 03 '13 at 13:39
  • @juned but what if i want to set screen vertical if its small and horizontal if its bigger ! – Mahdi Giveie Jan 03 '13 at 14:30
  • @Rajesh i want to have more features in Tablet version ! is there anyway to have a feature in tablet but not in small device? – Mahdi Giveie Jan 03 '13 at 14:39
  • 1
    yeah you can.. do those designs in the layout-xlarge and do the codes and works according to the Android SDK Version. you can find the running os of devices. s from this you can do.. – itsrajesh4uguys Jan 03 '13 at 14:46
  • @Rajesh but SDK version would not help , cause both tablets and smartphones are running android 4 !! – Mahdi Giveie Jan 03 '13 at 14:51
  • oh.... so have to search for this. – itsrajesh4uguys Jan 03 '13 at 14:55
  • 1
    @MahdiGiveie you may have diferent layout for small screens i.e `layout-normal` or `layout-small`. an additionally please refer this http://stackoverflow.com/questions/12242111/application-skeleton-to-support-multiple-screen – Juned Jan 04 '13 at 08:13

1 Answers1

1

I would like to give you some suggestions.

it will be the same APK , or its better to Create another APK ?

It should be a single app.

if it will be same APK , how can i force the app to stick on Vertical for Smartphones and stick on Horizontal for Tablets? ( Meaning if app is running on tablets it will never rotate to vertical and vice versa for smartphones )

For layout issues concider this. which should give you some basic idea about how to acheive it.

how can i define layouts for horizontal ?!

For horizontal layouts you can define a seperate layout. You check for the screen size or whatever stuffs which proves for horizontal layout and set the layout.

if anyone got special experience on doing this please share it with me

I have followed it by using the screen sizes and I have used the layout depending on the size. Have a look at this explains somethings to you.

Edit :

Same applies for the vertical layout as well. That is have a vertical layout defined.

For Horizontal use dp. Know about it with above first link. There you can have it like below.

Density-independent pixel (dp)
A virtual pixel unit that you should use when defining UI layout, to express layout dimensions or position in a density-independent way. The density-independent pixel is equivalent to one physical pixel on a 160 dpi screen, which is the baseline density assumed by the system for a "medium" density screen. At runtime, the system transparently handles any scaling of the dp units, as necessary, based on the actual density of the screen in use. The conversion of dp units to screen pixels is simple: px = dp * (dpi / 160). For example, on a 240 dpi screen, 1 dp equals 1.5 physical pixels. You should always use dp units when defining your application's UI, to ensure proper display of your UI on screens with different densities.

Vinay
  • 6,891
  • 4
  • 32
  • 50