I've been searching Google, Stack Overflow, and the android developer's guide and yet, I cannot get a good solution to this problem.
I've tried the unbind drawables method:
unbindDrawables(View view)
{
if (view.getBackground() != null)
{
view.getBackground().setCallback(null);
}
if (view instanceof ViewGroup)
{
for (int i = 0; i < ((ViewGroup) view).getChildCount(); i++)
{
unbindDrawables(((ViewGroup) view).getChildAt(i));
}
((ViewGroup) view).removeAllViews();
}
}
And I can't use the loading large bitmaps efficiently from the android documentation, since the size I made the images is the maximum size (740 x 1140 pngs) that I want, and I don't know what other sizes I could plug into the call:
mImageView.setImageBitmap(
decodeSampledBitmapFromResource(getResources(), R.id.myimage, 100, 100));
Also, every activity has a 740x1140 png background, with other smaller image views for enemies and buttons and things. the most I have on screen at a time is about 8. I assign all of these images through XML. However, i finish every activity after I start a new one, yet it seems as if no memory is being freed.
Below is my beginning layout and logcat.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/bro_quest_start_bg"
android:orientation="vertical"
android:scaleType="centerCrop"
tools:context="com.torch2424.broquest.StartScreen" >
<ImageView
android:id="@+id/broquesttitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/rrppgg_title"
android:contentDescription="@string/tank" />
<Button
android:id="@+id/start"
android:layout_width="120dp"
android:layout_height="55dp"
android:background="@drawable/buttons"
android:onClick="fight"
android:layout_gravity="center_horizontal"
android:text="@string/start" />
<Button
android:id="@+id/journal"
android:layout_width="120dp"
android:layout_height="55dp"
android:background="@drawable/buttons"
android:layout_gravity="center_horizontal"
android:onClick="journal"
android:text="@string/journal" />
<Button
android:id="@+id/character"
android:layout_width="120dp"
android:layout_height="55dp"
android:background="@drawable/buttons"
android:layout_gravity="center_horizontal"
android:onClick="character"
android:text="@string/character" />
<Button
android:id="@+id/shop"
android:layout_width="120dp"
android:layout_height="55dp"
android:background="@drawable/buttons"
android:layout_gravity="center_horizontal"
android:onClick="shop"
android:text="@string/shop" />
<Button
android:id="@+id/options"
android:layout_width="120dp"
android:layout_height="55dp"
android:background="@drawable/buttons"
android:layout_gravity="center_horizontal"
android:onClick="options"
android:text="@string/options" />
<Button
android:id="@+id/quit"
android:layout_width="120dp"
android:layout_height="55dp"
android:layout_gravity="center_horizontal"
android:background="@drawable/buttons"
android:onClick="quit"
android:text="@string/quit" />
Link to Logcat, Log cat format would not play nice with stack overflow :( http://pastebin.com/dZSPaq4d
P.S the images are all drawables in my drawable folder