My app force closes on setcontentview when using the holoeverywhere library
Asked Answered
E

1

1

Hi I'm trying to make my app backwards compatible using holoeverywhere. In my app I have a tab activity and 3 holoeverywhere activitys. When I run my app on a 2.3.3 emulator it runs and my first tab is shown but if I switch to my second or third tab it closes unexpectedly. The error occurs in my second or third tab on my setContentView line. The error isn't caused by switching tabs because if I have the app start on the second tab by default I still get the same error. If I run my app on a 4.1.2 device then it works just fine though.

Here is my logcat

12-26 13:33:03.511: E/AndroidRuntime(744): FATAL EXCEPTION: main
12-26 13:33:03.511: E/AndroidRuntime(744): java.lang.RuntimeException: Unable to start            activity ComponentInfo{com.chair49.holotimer/com.chair49.holotimer.StopWatch}:         android.view.InflateException: Binary XML file line #20: Error inflating class android.view.View
12-26 13:33:03.511: E/AndroidRuntime(744):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
12-26 13:33:03.511: E/AndroidRuntime(744):  at android.app.ActivityThread.startActivityNow(ActivityThread.java:1487)
12-26 13:33:03.511: E/AndroidRuntime(744):  at android.app.LocalActivityManager.moveToState(LocalActivityManager.java:127)
12-26 13:33:03.511: E/AndroidRuntime(744):  at android.app.LocalActivityManager.startActivity(LocalActivityManager.java:339)
12-26 13:33:03.511: E/AndroidRuntime(744):  at android.widget.TabHost$IntentContentStrategy.getContentView(TabHost.java:654)
12-26 13:33:03.511: E/AndroidRuntime(744):  at android.widget.TabHost.setCurrentTab(TabHost.java:326)
12-26 13:33:03.511: E/AndroidRuntime(744):  at android.widget.TabHost$2.onTabSelectionChanged(TabHost.java:132)
12-26 13:33:03.511: E/AndroidRuntime(744):  at android.widget.TabWidget$TabClickListener.onClick(TabWidget.java:456)
12-26 13:33:03.511: E/AndroidRuntime(744):  at  android.view.View.performClick(View.java:2485)
12-26 13:33:03.511: E/AndroidRuntime(744):  at android.view.View$PerformClick.run(View.java:9080)
12-26 13:33:03.511: E/AndroidRuntime(744):  at android.os.Handler.handleCallback(Handler.java:587)
12-26 13:33:03.511: E/AndroidRuntime(744):  at android.os.Handler.dispatchMessage(Handler.java:92)
12-26 13:33:03.511: E/AndroidRuntime(744):  at android.os.Looper.loop(Looper.java:123)
12-26 13:33:03.511: E/AndroidRuntime(744):  at android.app.ActivityThread.main(ActivityThread.java:3683)
12-26 13:33:03.511: E/AndroidRuntime(744):  at java.lang.reflect.Method.invokeNative(Native Method)
12-26 13:33:03.511: E/AndroidRuntime(744):  at java.lang.reflect.Method.invoke(Method.java:507)
12-26 13:33:03.511: E/AndroidRuntime(744):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
12-26 13:33:03.511: E/AndroidRuntime(744):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
12-26 13:33:03.511: E/AndroidRuntime(744):  at dalvik.system.NativeStart.main(Native Method)
12-26 13:33:03.511: E/AndroidRuntime(744): Caused by: android.view.InflateException: Binary XML file line #20: Error inflating class android.view.View
12-26 13:33:03.511: E/AndroidRuntime(744):  at android.view.LayoutInflater.createView(LayoutInflater.java:518)
12-26 13:33:03.511: E/AndroidRuntime(744):  at android.view.LayoutInflater.onCreateView(LayoutInflater.java:549)
12-26 13:33:03.511: E/AndroidRuntime(744):  at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:66)
12-26 13:33:03.511: E/AndroidRuntime(744):  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:568)
12-26 13:33:03.511: E/AndroidRuntime(744):  at android.view.LayoutInflater.rInflate(LayoutInflater.java:623)
12-26 13:33:03.511: E/AndroidRuntime(744):  at android.view.LayoutInflater.rInflate(LayoutInflater.java:626)
12-26 13:33:03.511: E/AndroidRuntime(744):  at android.view.LayoutInflater.rInflate(LayoutInflater.java:626)
12-26 13:33:03.511: E/AndroidRuntime(744):  at android.view.LayoutInflater.inflate(LayoutInflater.java:408)
12-26 13:33:03.511: E/AndroidRuntime(744):  at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
12-26 13:33:03.511: E/AndroidRuntime(744):  at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
12-26 13:33:03.511: E/AndroidRuntime(744):  at com.actionbarsherlock.internal.ActionBarSherlockCompat.setContentView(ActionBarSherlockCompat.java:853)
12-26 13:33:03.511: E/AndroidRuntime(744):  at com.actionbarsherlock.app.SherlockActivity.setContentView(SherlockActivity.java:229)
12-26 13:33:03.511: E/AndroidRuntime(744):  at com.chair49.holotimer.StopWatch.onCreate(StopWatch.java:49)  // this is my setcontentview line
12-26 13:33:03.511: E/AndroidRuntime(744):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
12-26 13:33:03.511: E/AndroidRuntime(744):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
12-26 13:33:03.511: E/AndroidRuntime(744):  ... 18 more
12-26 13:33:03.511: E/AndroidRuntime(744): Caused by: java.lang.reflect.InvocationTargetException
12-26 13:33:03.511: E/AndroidRuntime(744):  at java.lang.reflect.Constructor.constructNative(Native Method)
12-26 13:33:03.511: E/AndroidRuntime(744):  at java.lang.reflect.Constructor.newInstance(Constructor.java:415)
12-26 13:33:03.511: E/AndroidRuntime(744):  at android.view.LayoutInflater.createView(LayoutInflater.java:505)
12-26 13:33:03.511: E/AndroidRuntime(744):  ... 32 more
12-26 13:33:03.511: E/AndroidRuntime(744): Caused by: android.content.res.Resources$NotFoundException: Resource is not a Drawable (color or path): TypedValue{t=0x2/d=0x101030a a=-1}
12-26 13:33:03.511: E/AndroidRuntime(744):  at android.content.res.Resources.loadDrawable(Resources.java:1681)
12-26 13:33:03.511: E/AndroidRuntime(744):  at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
12-26 13:33:03.511: E/AndroidRuntime(744):  at android.view.View.<init>(View.java:1951)
12-26 13:33:03.511: E/AndroidRuntime(744):  at android.view.View.<init>(View.java:1899)
12-26 13:33:03.511: E/AndroidRuntime(744):  ... 35 more

Here is my xml for my third tab

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >

<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_alignParentLeft="true"
    android:layout_weight="50"
    android:gravity="bottom"
    android:weightSum="100">

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="48dp"
        android:layout_alignParentBottom="true" >

        <View
            android:id="@+id/view1"
            android:layout_width="match_parent"
            android:layout_height="1dip"
            android:layout_alignParentTop="true"
            android:layout_marginLeft="4dip"
            android:layout_marginRight="4dip"
            android:background="?android:attr/android:dividerVertical" />

        <View
            android:id="@+id/ViewColorPickerHelper"
            android:layout_width="1dip"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:layout_alignParentTop="true"
            android:layout_centerHorizontal="true"
            android:layout_marginBottom="4dip"
            android:layout_marginTop="4dip"
            android:background="?android:attr/android:dividerVertical" />

        <org.holoeverywhere.widget.Button
            android:id="@+id/bStart"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignLeft="@+id/view1"
            android:layout_alignParentTop="true"
            android:layout_toLeftOf="@+id/ViewColorPickerHelper"
             style="@style/Holo.Button.Borderless"
            android:text="Start" />

        <org.holoeverywhere.widget.Button
            android:id="@+id/bStop"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:layout_alignParentTop="true"
            android:layout_alignRight="@+id/view1"
            android:layout_toRightOf="@+id/ViewColorPickerHelper"
             style="@style/Holo.Button.Borderless"
            android:text="Stop" />
    </RelativeLayout>
</LinearLayout>

<Chronometer
    android:id="@+id/chronometer2"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentRight="true"
    android:layout_alignParentTop="true"
    android:text="Chronometer"
    android:textSize="0px"
    android:visibility="invisible" />

<TableLayout
    android:id="@+id/tableLayout1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_marginTop="56dp" >

    <TableRow
        android:id="@+id/tableRow1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >

        <ImageButton
            android:id="@+id/hourup"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
             style="@style/Holo.Button.Borderless"
            android:clickable="false"
            android:src="@drawable/up"
            android:visibility="invisible" />

        <ImageButton
            android:id="@+id/minuteup"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
             style="@style/Holo.Button.Borderless"
            android:clickable="false"
            android:src="@drawable/up"
            android:visibility="invisible" />

        <ImageButton
            android:id="@+id/secondup"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            style="@style/Holo.Button.Borderless"
            android:clickable="false"
            android:src="@drawable/up"
            android:visibility="invisible" />
    </TableRow>

    <TableRow
        android:id="@+id/tableRow2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >

        <org.holoeverywhere.widget.TextView
            android:id="@+id/hour"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:text="00 : "
            android:textSize="35sp" />

        <org.holoeverywhere.widget.TextView
            android:id="@+id/minute"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:text="00 : "
            android:textSize="35sp" />

        <org.holoeverywhere.widget.TextView
            android:id="@+id/second"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:text="00"
            android:textSize="35sp" />

        <org.holoeverywhere.widget.TextView
            android:id="@+id/ending"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginBottom="58dp"
            android:text=".000" />
    </TableRow>

    <TableRow
        android:id="@+id/tableRow3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >

        <ImageButton
            android:id="@+id/hourdown"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            style="@style/Holo.Button.Borderless"
            android:clickable="false"
            android:src="@drawable/down"
            android:visibility="invisible" />

        <ImageButton
            android:id="@+id/minutedown"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            style="@style/Holo.Button.Borderless"
            android:clickable="false"
            android:src="@drawable/down"
            android:visibility="invisible" />

        <ImageButton
            android:id="@+id/seconddown"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            style="@style/Holo.Button.Borderless"
            android:clickable="false"
            android:src="@drawable/down"
            android:visibility="invisible" />
    </TableRow>
</TableLayout>

Exhaust answered 26/12, 2012 at 21:3 Comment(3)
Caused by: android.view.InflateException: Binary XML file line #20: Error inflating class android.view.View 12-26 13:33:03.511: E/AndroidRuntime(744): Caused by: android.content.res.Resources$NotFoundException: Resource is not a Drawable (color or path): TypedValue{t=0x2/d=0x101030a a=-1}Drill
Do you have the "up" and "down" files in your drawable folders? And are they supported file types?Ridings
@Ridings yea I have the up and down images in the right folder and they are supported I know this because this app runs properly on my 4.1.2 deviceExhaust
L
1

?android:attr/android:dividerVertical

What is it?

?dividerVertical

And it: style="@style/Holo.Button.Borderless"
Right: style="?borderlessButtonStyle"

And it: <org.holoeverywhere.widget.TextView />
<TextView /> Didn't work?

Lowly answered 27/12, 2012 at 6:25 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.