[Solved] Supporting multiple devices.

How can i make my app support multiple devices?
Im making the app without engines like libgdx so i can understand android development better(i guess).

I’ve made different resolution images for hdpi,mdpi and ldpi.
What dp width and height should i use in my xml code so it support most of the devices and does not look stretched?
Should i make different layouts for different devices or something?

Here is my xml code for the splash image:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/backgroundId"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@color/black"
    android:gravity="center"
    android:orientation="vertical" >

    <ImageView
        android:id="@+id/splashId"
        android:layout_width="match_parent"
        android:layout_height="240dp"
        android:background="@drawable/splash"
        android:contentDescription="@string/splash"
        android:orientation="vertical" >
    </ImageView>

</RelativeLayout>

Thank you.

Most of the people on this forum don’t know anything about android layouts. You’ll have better luck asking elsewhere.

Why do you say that? I’ve dabbled in Android development a little, maybe some people on here have too.

@OP I’m pretty sure unless you created the picture for phones, but used it for a tablet, you wouldn’t really see a difference. When I was learning Android development, no one ever told me to make multiple backgrounds.

I’ve solved the problem.

I had to make folders layout-small, layout-large etc. and make own layouts for them.

also i had to add “supports-screens” in manifest:

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

Now im experiencing problems with animation.
Maybe i should just use engine to make games for android, but i dont think i will learn much if i do so.

I don’t really think that’s the correct solution. I’ve only recently started dabbling in pure android code, but if it’s the same app why do you need different layouts? Should be the same layout, scaled differently. Also, do you want the game size to be scaled up to maximum (aka take the lesser screen dimension and scale the x/y to that), or just not changed at all?

I read somewhere that when you make a folder named for example layout-large.
Then it recognizes if the app is played on hdpi devices and it runs the layout in the layout-large folder.

I really dont know if this is the best solution but good enough for me since im not doing fancy stuff with my app.

Here is a good link: http://developer.android.com/guide/practices/screens_support.html