Please help me with the following crash.

I got NumberPicker widget code from some web page and with little
modification was using in one of my project. It is displayed properly
when I compile the java file. But I need to use it in multiple
projects, so I thought of making a jar file from it.

The first error was due to duplicate entry of manifest file. So I
removed manifest from the jar. It compiled and when I run I'm getting
the following error.

I have separate R.java created in both the library and application
using it. Don't know whether that is the issue and if it is, how to
fix that.

I had posted the issue in stackoverflow few weeks before. There are
more than 80 views without any help :(
http://stackoverflow.com/questions/8478778/android-crash-when-using-numberpicker-widget


>From LogCat


12-12 22:57:30.106: ERROR/AndroidRuntime(583): FATAL EXCEPTION: main
12-12 22:57:30.106: ERROR/AndroidRuntime(583):
java.lang.RuntimeException: Unable to start activity
ComponentInfo{com.nessaid.nessalarm/
com.nessaid.nessalarm.AlarmDetails}: android.view.InflateException:
Binary XML file line #77: Error inflating class
com.nessaid.numberpicker.NumberPicker
12-12 22:57:30.106: ERROR/AndroidRuntime(583):     at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
2663)

-------- Skipped Bottom Stack -----------

12-12 22:57:30.106: ERROR/AndroidRuntime(583): Caused by:
android.view.InflateException: Binary XML file line #77: Error
inflating class com.nessaid.numberpicker.NumberPicker
12-12 22:57:30.106: ERROR/AndroidRuntime(583):     at
android.view.LayoutInflater.createView(LayoutInflater.java:513)
12-12 22:57:30.106: ERROR/AndroidRuntime(583):     at
android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:565)

-------- Skipped Bottom Stack -----------

12-12 22:57:30.106: ERROR/AndroidRuntime(583):     at
com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:
198)
12-12 22:57:30.106: ERROR/AndroidRuntime(583):     at
android.app.Activity.setContentView(Activity.java:1647)
12-12 22:57:30.106: ERROR/AndroidRuntime(583):     at
com.nessaid.nessalarm.AlarmDetails.onCreate(AlarmDetails.java:37)
12-12 22:57:30.106: ERROR/AndroidRuntime(583):     at
android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:
1047)
12-12 22:57:30.106: ERROR/AndroidRuntime(583):     at
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:
2627)
12-12 22:57:30.106: ERROR/AndroidRuntime(583):     ... 11 more

12-12 22:57:30.106: ERROR/AndroidRuntime(583): Caused by:
java.lang.reflect.InvocationTargetException
12-12 22:57:30.106: ERROR/AndroidRuntime(583):     at
com.nessaid.numberpicker.NumberPicker.<init>(NumberPicker.java:111)
12-12 22:57:30.106: ERROR/AndroidRuntime(583):     at
java.lang.reflect.Constructor.constructNative(Native Method)
12-12 22:57:30.106: ERROR/AndroidRuntime(583):     at
java.lang.reflect.Constructor.newInstance(Constructor.java:446)
12-12 22:57:30.106: ERROR/AndroidRuntime(583):     at
android.view.LayoutInflater.createView(LayoutInflater.java:500)
12-12 22:57:30.106: ERROR/AndroidRuntime(583):     ... 23 more
12-12 22:57:30.106: ERROR/AndroidRuntime(583): Caused by:
android.view.InflateException: Binary XML file line #77: Error
inflating class <unknown>
12-12 22:57:30.106: ERROR/AndroidRuntime(583):     at
android.view.LayoutInflater.createView(LayoutInflater.java:513)
12-12 22:57:30.106: ERROR/AndroidRuntime(583):     at
android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:565)
12-12 22:57:30.106: ERROR/AndroidRuntime(583):     at
android.view.LayoutInflater.rInflate(LayoutInflater.java:618)

12-12 22:57:30.106: ERROR/AndroidRuntime(583): Caused by:
java.lang.reflect.InvocationTargetException
12-12 22:57:30.106: ERROR/AndroidRuntime(583):     at
com.nessaid.numberpicker.NumberPicker.<init>(NumberPicker.java:111)
12-12 22:57:30.106: ERROR/AndroidRuntime(583):     at
java.lang.reflect.Constructor.constructNative(Native Method)
12-12 22:57:30.106: ERROR/AndroidRuntime(583):     at
java.lang.reflect.Constructor.newInstance(Constructor.java:446)
12-12 22:57:30.106: ERROR/AndroidRuntime(583):     at
android.view.LayoutInflater.createView(LayoutInflater.java:500)
12-12 22:57:30.106: ERROR/AndroidRuntime(583):     ... 34 more
12-12 22:57:30.106: ERROR/AndroidRuntime(583): Caused by:
android.view.InflateException: Binary XML file line #77: Error
inflating class <unknown>
12-12 22:57:30.106: ERROR/AndroidRuntime(583):     at
android.view.LayoutInflater.createView(LayoutInflater.java:513)
12-12 22:57:30.106: ERROR/AndroidRuntime(583):     at
android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:565)
12-12 22:57:30.106: ERROR/AndroidRuntime(583):     at
android.view.LayoutInflater.rInflate(LayoutInflater.java:618)

Here's my NumberPicker xml file

<merge xmlns:android="http://schemas.android.com/apk/res/android";>

    <NumberPickerButton android:id="@+id/increment"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/timepicker_up_btn" />

    <EditText android:id="@+id/timepicker_input"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:singleLine="true"
        style="?android:attr/textAppearanceLargeInverse"
        android:textColor="@android:color/primary_text_light"
        android:textSize="30sp"
        android:background="@drawable/timepicker_input" />

    <NumberPickerButton android:id="@+id/decrement"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/timepicker_down_btn" />

</merge>

main xml using the NumberPicker class

<view class="com.nessaid.numberpicker.NumberPicker" android:id="@+id/
picker1"
            android:layout_width="wrap_content"
                android:layout_height="fill_parent"
                android:focusable="true"
                android:paddingTop="5dip"
                android:focusableInTouchMode="true"/>

I had tried the following declaration too

<com.nessaid.numberpicker.NumberPicker android:id="@+id/picker1"
            android:layout_width="wrap_content"
                android:layout_height="fill_parent"
                android:focusable="true"
                android:paddingTop="5dip"
                android:focusableInTouchMode="true"/>

And crash seems to happen at the initiation

setContentView(R.layout.detail_form);

    which inturn shows the lines in NumberPicker.java

        public NumberPicker(Context context) {
            this(context, null);
        }

        public NumberPicker(Context context, AttributeSet attrs) {
            **this(context, attrs, 0);** // Crashes Here
        }

        //@SuppressWarnings({"UnusedDeclaration"})
        public NumberPicker(Context context, AttributeSet attrs, int
defStyle) {
            super(context, attrs);
            setOrientation(VERTICAL);
            //---------- Rest of Constructor Skipped ---------

Any help will be great ...I'm stuck with this.

Thank you,

Saithalavi.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to