Simulation of low memory exception while background is big

52 Views Asked by At

I have an app which is in production but some users report background in one of my activites does not load and I guess this is due to low memory during rendering of application in some phone.

The structure of app is as this:

There is an activity which have a ViewPager inside it and each page of ViewPager is a fragment with below layout and my problem is not loading background in android:background="@drawable/bg_back_port" is not loaded in some phonges. Background is a .jpg files with 23KB of size and resolution of 800x1023.

    <android.support.v4.widget.DrawerLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/drawer_layout"
        android:layout_width="match_parent"
        android:layout_height="match_parent" >

        <!-- The main content view -->

        <FrameLayout
            android:background="@drawable/bg_back_port"
            android:id="@+id/content_frame"
            android:layout_width="match_parent"
            android:layout_height="match_parent" >


            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent" >


                <ScrollView
                    android:id="@+id/contentView"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:layout_below="@id/titleBar"
                    android:fillViewport="true" >
                    <!--android:background="@drawable/bg_inside_port"-->

                    <LinearLayout
                        android:id="@+id/linearLayoutRoot"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:orientation="vertical"
                        android:paddingTop="20dp"
                        tools:context=".ActivityDisplayPage" >

                    </LinearLayout>
                </ScrollView>

                <ProgressBar
                    android:id="@+id/progressBar1"
                    style="?android:attr/progressBarStyleLarge"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_centerInParent="true"
                    android:visibility="gone" />

                <ImageView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:id="@+id/imvStarred"
                    android:src="@drawable/paper_locked"
                    android:layout_centerVertical="true"
                    android:layout_centerHorizontal="true" />
            </RelativeLayout>

        </FrameLayout>
        <!-- The navigation drawer -->

        <ListView
            android:id="@+id/left_drawer"
            android:layout_width="240dp"
            android:layout_height="match_parent"
            android:layout_gravity="start"
            android:background="#F0999999"
            android:choiceMode="singleChoice"
            android:divider="@android:color/transparent"
            android:dividerHeight="0dp"
            android:paddingBottom="10dp" />
    </android.support.v4.widget.DrawerLayout>

</RelativeLayout>

I can't simulate situation and I'm not sure why background is not displayed on some phones.

I did applied different constraints on emulators however this situation did not arise so I can fix the bug.

Are there any methods to simulate this situation or force low memory to an app in emulators or test environment?

0

There are 0 best solutions below