Reputation: 67
First off let me apologize for any layout/formatting errors, I'm doing this on my cell.
That being said, I cannot for the life of me figure out what is wrong with the below xml. With it in my layout file, the app crashes on load, but if I cut it out, the app loads and runs fine. Any help in figuring out the problem would be greatly appreciated.
Note: The drawables are all .jpg files in the drawable folder. Note: This section is cut from within another vertical linearlayout
Not sure if can/how to copy logcat from Aide. However, the logcat finally popped and it is an out of memory exception. I will try reducing the image size and come back.
<TextView
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_width="wrap_content"
android:text="Current Favorites"/>
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:orientation="horizontal"
android:gravity="center">
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:orientation="vertical"
android:gravity="center">
<ImageView
android:layout_height="100dp"
android:layout_width="wrap_content"
android:src="@drawable/mia_sollis"/>
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="Mia Sollis"/>
</LinearLayout>
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:orientation="vertical"
android:gravity="center">
<ImageView
android:layout_height="100dp"
android:layout_width="wrap_content"
android:src="@drawable/pepper_kester"/>
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="Pepper Kester"/>
</LinearLayout>
<LinearLayout
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:orientation="vertical"
android:gravity="center">
<ImageView
android:layout_height="100dp"
android:layout_width="wrap_content"
android:src="@drawable/jayme"/>
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="Jayme Langford"/>
</LinearLayout>
</LinearLayout>
Upvotes: 0
Views: 819
Reputation: 128
The possible answer is,
<ImageView
android:layout_height="100dp"
android:layout_width="wrap_content"
android:src="@drawable/mia_sollis"/>
image "mia_sollis" is too big and hence is giving out of memory error. Try out with smaller size image, it will solve your problem.
Upvotes: 2
Reputation: 2519
You have to post your Log
I guess
maybe the size of images is too big for your app memory.
add this to your Application
tag in Manifest
<application
.......
android:largeHeap="true"
........ >
Upvotes: 0
Reputation: 1103
Possible reasons based on your XML layout:
1) You forgot to add this on top of your layout file
xmlns:android="http://schemas.android.com/apk/res/android"
2) Second and the most important
You have multiple root tag, TextView and LinearLayout both of them is your root. However, you MUST have one root layout and inside it, do what ever you want.
Cheers!
Upvotes: 1