Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Create an application for both tablet and mobile

I want to Create an application that support on Both mobile and tablet version of android devices.I like to Upload one apk file to android market to achieve that.

it will works as follows.

  1. For mobile this application will work with small UI
  2. For tablet other than using honey comb work with different UI that uses it more large screen
  3. Tablet that powered by Honeycomb will have different UI that support it's special features

How can I do that.Correct me If I am wrong.

Regards, Kariyachan

like image 533
Dev.Sinto Avatar asked Nov 15 '22 00:11

Dev.Sinto


1 Answers

There are several ways doing that.

First you can create different values folders. Each folder may have dimensions which are used for several sizes.

Second attempt is creating different layouts. There is a good cheatsheet for the different foldernames:

http://petrnohejl.github.io/Android-Cheatsheet-For-Graphic-Designers/

Then you can add several drawable files for different screensizes.

Another helpfull way is using fragments. For example, a phone will have 2 activities with a list and a content while a tablet have just one which display a list, and the content.

You can see all possible folders at http://developer.android.com/guide/practices/screens_support.html

Another way is creating several defining which devices (resolution) may use your app.

You can define it within the manifest:

<compatible-screens>
    <!-- all small size screens -->
    <screen android:screenSize="small" android:screenDensity="ldpi" />
    <screen android:screenSize="small" android:screenDensity="mdpi" />
    <screen android:screenSize="small" android:screenDensity="hdpi" />
    <screen android:screenSize="small" android:screenDensity="xhdpi" />
    <!-- all normal size screens -->
    <screen android:screenSize="normal" android:screenDensity="ldpi" />
    <screen android:screenSize="normal" android:screenDensity="mdpi" />
    <screen android:screenSize="normal" android:screenDensity="hdpi" />
    <screen android:screenSize="normal" android:screenDensity="xhdpi" />
</compatible-screens>

or

<supports-screens android:smallScreens="false"
                  android:normalScreens="false"
                  android:largeScreens="true"
                  android:xlargeScreens="true"
                  android:requiresSmallestWidthDp="600" />

Here's a good sample using fragments:

http://developer.android.com/guide/components/fragments.html

All possible folder definitions are listed below at

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

for example:

 layout-sw320p
 values-h720dp (screen must be higher then 720dp)

And then create a dimension file which have different resolutions, colors, whatever.

like image 117
Emanuel S Avatar answered Nov 29 '22 05:11

Emanuel S