Gabrielle
Gabrielle

Reputation: 4981

Android app supporting all devices

I need to make sure my Android app works on all Android phones. How would I go about making sure that it works on all of them?

In my xml files I only use fill_parent and wrap_content and for layout I use LinearLayout. In my app I download some images from the web, save them to sdcard, and then display them. When an image is selected I play a video from the sdcard.

That's my app. Will it look the same on all android phones?

If not, what should I do?

Upvotes: 1

Views: 2879

Answers (5)

Navdroid
Navdroid

Reputation: 1549

You need to define supports-screen inside the AndroidManifest.xml file.

And if you are selecting a version you could use android:minSdkVersion &
android:targetSdkVersion.

Upvotes: 1

AdamM
AdamM

Reputation: 4440

Relative layout and always use DIP is way to make it work on all devices. However one warning, don't always trust the emulator, I designed and tested my app all on the emulator, however when I moved it to phone and my workmates, it was different on both our phones, so be careful

Upvotes: 1

Abhinav Singh Maurya
Abhinav Singh Maurya

Reputation: 3313

For this condition there are two things

1) you have to write small code in you manifest file after ending of application tag

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

2) If you are giving height and width of any widget (i.e. button or layout) in size such as 40px or 40 px etc change this thing into DIP(Device independent pixels). Use Layout:weight to make layout fixable to every screen. android:gravity or android:layout_gravity to fix layout to any place. and if you want to make fix it at particular position and linear layout in not help full use relative layout

Upvotes: 1

Jordi Coscolla
Jordi Coscolla

Reputation: 1066

Be aware that not all the android devices have an sdcard, an surely lot of them have the sdcard almost full.

I think the application must work and see alright in all the devices (be sure to test with the emulator all the pixel densities) and also take care in the cases that the android doesn't have the sdcard.

Upvotes: 1

Lukas Knuth
Lukas Knuth

Reputation: 25755

The only thing you can do to check this is test your application on as many devices/emulator-configurations as possible.

If you are concerned if you app will look good on all Smart-Phones and Tablets, you can create multiple Android-Emulators to test it.

Further information about how to optimize your app for multiple screens can be found in the docs.

Upvotes: 2

Related Questions