i’m getting an error when i run an app on my phone but when i start it via emulator it works fine. Emulator runs on same 2.1 froyo as my phone.
The error i get is
android.view.InflateException: Binary XML file line #5: Error inflating class <unknown>
The problem happens in this code:
LayoutInflater vi = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
v = vi.inflate(R.layout.list, null);
When i try to inflate this view. Btw in my xml code is evrything ok, otherwise it wouldn’t work on emulator either.
But if u think it my help here it is:
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TableRow
android:layout_width="fill_parent"
android:layout_height="15dp"
android:background="@drawable/bg_seznam" >
<TextView
android:id="@+id/item_title"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingLeft="17dp"
android:textColor="#ffffff"
android:textSize="20dp"
android:textStyle="bold"
android:typeface="serif" >
</TextView>
</TableRow>
<TableRow
android:layout_width="fill_parent"
android:paddingBottom="5dp"
android:paddingTop="5dp" >
<TextView
android:id="@+id/item_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.6"
android:ellipsize="end"
android:maxLines="1"
android:paddingLeft="17dp"
android:scrollHorizontally="true"
android:singleLine="false"
android:textSize="18dp"
android:textStyle="bold"
android:typeface="serif" >
</TextView>
<TextView
android:id="@+id/item_distance"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.3"
android:ellipsize="end"
android:maxLines="1"
android:scrollHorizontally="true"
android:singleLine="false"
android:textColor="#3b5688"
android:textSize="18dp"
android:textStyle="bold"
android:typeface="serif" >
</TextView>
<ImageView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.1"
android:contentDescription="@string/hello_world"
android:src="@drawable/naprej" />
</TableRow>
</TableLayout>
edit: btw, it’s the same if i use this:
LayoutInflater vi = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
v = vi.inflate(R.layout.list, null);
Solved!!!!
I’was trying difreent things and it ended up, the whole problem was that there was a problem with my image bg_seznam. I don’t know excactly why but somehow it was to small. I had it in xhdpi folder. All i did was to resize it to twice the normal and now it works like a charm.
Tenx for help CFlex, without ur’s idea about logcat i wouldn’t make it!