开发者

How to Create an application for both tablet and mobile

I want to Create an application that support on Both mobile and tabl开发者_开发知识库et 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


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.


There are a few ways to accomplish this. Fundamentally, there are basically two ways to launch an app:

  1. Build a native application with the OS language (iOS = objective C, Android = Java, etc.) (or)
  2. Build a web-based application that uses a responsive front-end that can fit any device size and submit it into the app store as a Webview (leveraging technology such as PhoneGap)

I suggest option #2 to accomplish your task.

Only one problem - if you're not traditionally a web-developer, it may not be as easy of a choice. My background is the UI/design side of building apps, much of my experience is within web-apps. Here's why I suggest option #2:

  • Building a web-based, responsive application first means you can launch on all platforms with one program (Desktop web, Tablet, iOS (Webview), Android (Webview),etc.
  • You only have one platform to maintain to begin with (vs. each native platform)
  • You can use analytics programs to know which platform gains most traction with the app and then decide which platform to build for native (i.e. Google Analytics (Free) http://google.com/analytics, Kiss Metrics (Paid) http://kissmetrics.com, etc.)
  • You can even use native phone functions with Webview apps using a program like PhoneGap (http://phonegap.com/)

If you're not familiar with responsive design, here are a few resources: http://johnpolacek.github.io/scrolldeck.js/decks/responsive/ http://www.smashingmagazine.com/2011/01/12/guidelines-for-responsive-web-design/

Here is some information on Webview apps for Android:

Android Webview:

Web Apps: http://developer.android.com/guide/webapps/index.html Building Web Apps in Webview: http://developer.android.com/guide/webapps/webview.html

iOS Webview:

Apple Allows Webview apps but must be able to use offline: https://forum.jquery.com/topic/apple-store-reject-webview-based-jquery-mobile-aplication

Now a Webview app isn't always a viable/best option for every type of app. For example, if you want to make a peer-to-peer messaging app, this could work because they are (often) rather lightweight programs that don't require too much bandwidth between the device and servers. But for something like a photo-sharing app, it'd be pretty impossible to pass image-sized files (and thousands of them) through the web to display on the device. In this case, a native app that leverages local storage would probably be a better option.

Hope this helps.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜