I am making a scrollView with a bunch of image buttons. Unfortunately this view takes a very long time to load – so much so that the user would be likely to close the app assuming it is an error.
Any ideas on how I can make this process faster?
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<TableLayout
android:layout_height="fill_parent"
android:layout_width="fill_parent"
>
<TableRow>
<ImageButton
android:id="@+id/ImageButtonCone"
android:layout_width="160dp"
android:layout_height="200dp"
android:scaleType="fitCenter"
android:background="@drawable/cone"
/>
<ImageButton
android:id="@+id/ImageButtonCube"
android:layout_width="160dp"
android:layout_height="200dp"
android:scaleType="fitCenter"
android:background="@drawable/cube"
/>
</TableRow>
<TableRow>
<ImageButton
android:id="@+id/ImageButtonCylinder"
android:layout_width="160dp"
android:layout_height="200dp"
android:scaleType="fitCenter"
android:background="@drawable/cylinder"
/>
<ImageButton
android:id="@+id/ImageButtonTrapezoidalprism"
android:layout_width="160dp"
android:layout_height="200dp"
android:scaleType="fitCenter"
android:background="@drawable/trapezoidal_prism"
/>
etc…
I’ve solved the problem… I only had png’s in the drawable-mdpi folder but not the other drawable folders. I’ve made copies of each png and pasted them in drawable-ldpi, drawable-mdpi and drawable-xhdpi and now it works very quickly on the phone aswell as the emulator.
Presumably the emulator was taking the medium definition .png’s but the phone wanted to take from a different resolution and wasn’t able to.