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?
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.
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.
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
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
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.
Related
i am suffering from last few days but i am not getting any perfect answer for that
android developer website
i
and apart from that i am also study lot of website but most of the website say's use dimen and used it for
small
normal
large
and x-large
but it is not giving me the perfect solution because most of the device which i am testing they all target normal dime such like that device start from 3.7 to 5 inch and because of that my card get moved up according to device i want the perfect appearance on each device there is a image attached to it
actually i want the perfect apperance on each device i found one method which is work fine to make a dimens xml according to the dimension of screen but it is not reliable i have to make more then 25 xml and if another device will come i have to make for these also this is image Url
If you want to support all devices then I think under my opinion You need make a check up on several points. These points are given below:
first you should make it sure that you are using right sizes in all drawable bucket. I am saying this because I think You are looking it perfect in some device but not looking good in other devices.
Do not make multiple xmls it is deprecated.
TO give margins for all devices you need to make different values folder or Dimens folder for different devices.
This is new way of supporting multiple devices , multiple xml is deprecated.
Here I am posting 2 links , this and this , check them out. I think that this is good for you to learn , just give it a try. And Up vote if this helps.
I created android app its working find and view of that app is perfect with my emulator,but when I install it in different devices layout or view is not showing properly,can any one give good suggestion for that,so that app can work same in all devices..
#Johnsan don't worry have not you ever set any property before?..here you can set either true or false...supports-screens android:resizeable="true" for more check this answer
Optimizing Android manifest file for largest number of supported devices
Sooo... I've come across a rather odd issue...
I am creating an app and need different versions of the layout for different devices. The default layout was made for my Nexus 7, so you can imagine it is quite large.
As recommended by the documentation, I created a layout-small folder in which I designed every Activity layout for a small device. So far so good, everything goes smoothly. I decide to change some buttons on my default layout as it will look better, but whenever I try to open it, it's display is of the 2.7''QVGA and whenever I try to change it back to the Nexus 7, Eclipse opens up my file from the layout-small folder! Damn it Eclipse! Let me choose what I open! When I run it, it still looks fine but this issue isn't allowing me to make any changes on what I have!
I already tried closing it and everything, but the damn small version of the layout keeps opening, over the default one!
Hope the issue is clear enough... I can see how it would be hard to understand.
Thank you very much for your time!
In your manifest, try letting the os know what sizes are supported by adding:
<supports-screens
android:smallScreens="true"
android:largeScreens="true"
android:xlargeScreens="true"/>
Once you have this in your manifest, you can also use it to switch the use of various sizes on and off by toggling between true and false, to help test and debug your code.
Also, make sure that the changes you've made to your default layout are valid. If the changes make your default xml un-useable then one of the others may be used instead.
hi guyz i know android says if u are working with gui adjust your layout positions in term of dp but in real life i faced that even dp is not benifial in my application i was using dp in layout adjustment but in the end in testing mode when we checked our application in different mobiles layout was not adjusting....and at last we handled it with code
now we have another target we want our same application compatible with Tablets...
(1) my application using Custom listview every where
how i can make compatible my app with tablet as well as mobile.
i just need help
thanks in advance
I'm assuming you mean using "dip" (density Independent pixels). With that said, have you looked at using Fragments? Fragments should help make the code more re-usable, and support tablet views and smaller screen views (phones) easier.
See here: http://developer.android.com/guide/topics/fundamentals/fragments.html
And here: http://mobile.tutsplus.com/tutorials/android/android-tablet-design/ (for a little tutorial)
You'll need API 3 at least, I believe.
Use fragments.
http://developer.android.com/guide/topics/fundamentals/fragments.html
<uses-sdk
android:minSdkVersion="3"
android:targetSdkVersion="4"/>
Got this really stupid problem:
Can find the proper name for the android folder for WVGA800 resources.
I've created a folder for WVGA854: drawable-normal-long-hdpi
It worked totally fine.
For WVGA800 I've tried 'drawable-normal-notlong-hdpi' - emulator and handset still gets resources from 'drawable', not even 'drawable-normal-long-hdpi'.
Tried using 'drawble-hdpi', 'drawable-notlong-hdpi' - nothing works, it keeps using 'drawable' for resources.
How should the folder for WVGA800 be named?
UPD:
Using
supports-screens android:anyDensity="true"
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"/>
Didnt solve the problem.
Is there a way to debug what resource folder is used and why?
Android is not like the iPhone. In iPhone it works to make full-screen images for the two supported resolutions, and rely on that. In Android, it doesn't work. There are too many resolutions, and more can come out any day of the week. The solution, then, is to really make the layouts and images device independent. Sometimes this requires creative solutions, but in any case it requires a change in thinking.
For example, we were trying to solve this same problem for a full-screen splash page. We had a logo, a gradient, and a set of objects at the bottom of the picture. The solution for us was to split these three things, allow the gradient to be stretched, and then position the logo in the center, and the objects at the bottom. This is the type of solution that is required in Android, and it will save you from having to cut a different graphic for every resolution.
You can also try nine-patch images for some of this. This would have worked great for our case except for the fact that the image included a gradient.
All seems correct, except you did a spelling mistake: "drawble". Check your directory names.
I suggest you try a more permissive resource filter first. Separate your assets in drawable-long and drawable-notlong, and see if it works.