Android programming. Application stopped unexpectedly.

Posted by user277704 on Stack Overflow See other posts from Stack Overflow or by user277704
Published on 2010-03-26T23:30:39Z Indexed on 2010/03/26 23:33 UTC
Read the original article Hit count: 2100

Filed under:
|

I've just created a prototype of interface for my android app and tried to run it. Unfortunately I get an error that my app has stopped unexpectedly (my reputation doesn't allow me to post images so follow my links):

screenshot of error message

This is layout mode of editing. Everything looks as I want so there shouldn't be errors:

mobileka.freehostia.com/3.png

(I can post only one hyperlink...)

This is my main.xml code:

<code>

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="top"
android:background="@drawable/back"
>

    <TextView
    android:id="@+id/score"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:text = "@string/scoreT"
 android:textColor="@string/scoreColor"
 android:gravity = "left"
 android:typeface="serif"

android:textStyle="bold|italic" android:textSize="16sp" android:paddingLeft = "10px" android:paddingTop="4px"/>

 <TextView
 android:id = "@+id/scoreTxt"
 android:layout_toRightOf="@+id/score"
 android:textSize="16sp"
 android:paddingTop = "5px"
 android:paddingLeft="4px"
 android:typeface="serif"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:text="    0"
 android:textColor="@string/scoreTextColor"
 android:gravity = "left"/>


 <TextView
 android:id = "@+id/scoreSeparator"
 android:layout_toRightOf="@+id/scoreTxt"
 android:textSize="16sp"
 android:paddingTop = "3px"
 android:paddingLeft="4px"
 android:typeface="serif"
 android:textStyle="bold"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:text="|"
 android:textColor="@string/scoreColor"
 android:gravity = "left"/> 

 <TextView
 android:id = "@+id/timerTxt"
 android:layout_alignParentRight="true"
 android:textSize="16sp"
 android:paddingRight="10px"
 android:paddingTop="4px"
 android:typeface="serif"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:textColor="@string/scoreTextColor"
 android:gravity = "right"
 android:text="00:00"
 />

 <TextView
 android:id = "@+id/timer"
 android:layout_toLeftOf="@+id/timerTxt"
 android:textColor="@string/scoreColor"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:textSize="16sp"
 android:padding = "3px"
 android:typeface="serif"
 android:textStyle="bold|italic"
 android:text="@string/timerT"
 android:gravity = "left"/>

 <TextView
 android:id = "@+id/timerSeparator"
 android:layout_toLeftOf="@+id/timer"
 android:textSize="16sp"
 android:paddingTop = "3px"
 android:paddingLeft="4px"
 android:typeface="serif"
 android:textStyle="bold"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:text="|"
 android:textColor="@string/scoreColor"
 android:gravity = "left"/> 

 <ImageButton 
 android:id="@+id/buttonOne"
 android:layout_below="@+id/score" 
 android:layout_marginTop="40px"
 android:layout_marginLeft="14px"
 android:layout_width="wrap_content" 
 android:layout_height="wrap_content" 
 android:clickable="true" android:src="@drawable/inactive"/>

 <ImageButton 
 android:id="@+id/buttonTwo"
 android:layout_toRightOf="@+id/buttonOne" 
 android:layout_marginTop="63px"
 android:layout_marginLeft="10px"
 android:layout_width="wrap_content" 
 android:layout_height="wrap_content" 
 android:src="@drawable/inactive"
 />

 <ImageButton 
 android:id="@+id/buttonThree"
 android:layout_toRightOf="@+id/buttonTwo" 
 android:layout_marginTop="63px"
 android:layout_marginLeft="10px"
 android:layout_width="wrap_content" 
 android:layout_height="wrap_content" 
 android:src="@drawable/inactive"
 />

 <ImageButton 
 android:id="@+id/buttonFour"
 android:layout_toRightOf="@+id/buttonThree" 
 android:layout_marginTop="63px"
 android:layout_marginLeft="10px"
 android:layout_width="wrap_content" 
 android:layout_height="wrap_content" 
 android:src="@drawable/inactive"
 />

 <ImageButton 
 android:id="@+id/buttonFive"
 android:layout_below="@+id/buttonOne" 
 android:layout_marginTop="40px"
 android:layout_marginLeft="14px"
 android:layout_width="wrap_content" 
 android:layout_height="wrap_content" 
 android:src="@drawable/inactive"
 />

 <ImageButton 
 android:id="@+id/buttonSix"
 android:layout_toRightOf="@+id/buttonFive" 
 android:layout_marginTop="164px"
 android:layout_marginLeft="10px"
 android:layout_width="wrap_content" 
 android:layout_height="wrap_content" 
 android:src="@drawable/inactive"
 />

 <ImageButton 
 android:id="@+id/buttonSeven"
 android:layout_toRightOf="@+id/buttonSix" 
 android:layout_marginTop="164px"
 android:layout_marginLeft="10px"
 android:layout_width="wrap_content" 
 android:layout_height="wrap_content" 
 android:src="@drawable/inactive"
 />

 <ImageButton 
 android:id="@+id/buttonEight"
 android:layout_toRightOf="@+id/buttonSeven" 
 android:layout_marginTop="164px"
 android:layout_marginLeft="10px"
 android:layout_width="wrap_content" 
 android:layout_height="wrap_content" 
 android:src="@drawable/inactive"
 />

 <ImageButton 
 android:id="@+id/buttonNine"
 android:layout_below="@+id/buttonEight" 
 android:layout_marginTop="40px"
 android:layout_marginLeft="14px"
 android:layout_width="wrap_content" 
 android:layout_height="wrap_content" 
 android:src="@drawable/inactive"
 />

 <ImageButton 
 android:id="@+id/buttonTen"
 android:layout_toRightOf="@+id/buttonNine" 
 android:layout_marginTop="264px"
 android:layout_marginLeft="10px"
 android:layout_width="wrap_content" 
 android:layout_height="wrap_content" 
 android:src="@drawable/inactive"
 />

 <ImageButton 
 android:id="@+id/buttonEleven"
 android:layout_toRightOf="@+id/buttonTen" 
 android:layout_marginTop="264px"
 android:layout_marginLeft="10px"
 android:layout_width="wrap_content" 
 android:layout_height="wrap_content" 
 android:src="@drawable/inactive"
 />

 <ImageButton 
 android:id="@+id/buttonTwelve"
 android:layout_toRightOf="@+id/buttonEleven" 
 android:layout_marginTop="264px"
 android:layout_marginLeft="10px"
 android:layout_width="wrap_content" 
 android:layout_height="wrap_content" 
 android:src="@drawable/inactive"
 />

And this is my logcat errors (p.s. line #12 is the first TextView in main.xml):


03-26 22:59:31.670: WARN/dalvikvm(185): threadid=3: thread exiting with uncaught exception (group=0x4001b188)

03-26 22:59:31.727: ERROR/AndroidRuntime(185): Uncaught handler: thread main exiting due to uncaught exception

03-26 22:59:31.784: ERROR/AndroidRuntime(185): java.lang.RuntimeException: Unable to start activity ComponentInfo{kz.androidmarket.www.randomtest1/kz.androidmarket.www.randomtest1.randomTest1}: android.view.InflateException: Binary XML file line #12: Error inflating class

03-26 22:59:31.784: ERROR/AndroidRuntime(185): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2496)

03-26 22:59:31.784: ERROR/AndroidRuntime(185): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)

03-26 22:59:31.784: ERROR/AndroidRuntime(185): at android.app.ActivityThread.access$2200(ActivityThread.java:119)

03-26 22:59:31.784: ERROR/AndroidRuntime(185): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)

03-26 22:59:31.784: ERROR/AndroidRuntime(185): at android.os.Handler.dispatchMessage(Handler.java:99)

03-26 22:59:31.784: ERROR/AndroidRuntime(185): at android.os.Looper.loop(Looper.java:123)

03-26 22:59:31.784: ERROR/AndroidRuntime(185): at android.app.ActivityThread.main(ActivityThread.java:4363)

03-26 22:59:31.784: ERROR/AndroidRuntime(185): at java.lang.reflect.Method.invokeNative(Native Method)

03-26 22:59:31.784: ERROR/AndroidRuntime(185): at java.lang.reflect.Method.invoke(Method.java:521)

03-26 22:59:31.784: ERROR/AndroidRuntime(185): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)

03-26 22:59:31.784: ERROR/AndroidRuntime(185): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)

03-26 22:59:31.784: ERROR/AndroidRuntime(185): at dalvik.system.NativeStart.main(Native Method)

03-26 22:59:31.784: ERROR/AndroidRuntime(185): Caused by: android.view.InflateException: Binary XML file line #12: Error inflating class

03-26 22:59:31.784: ERROR/AndroidRuntime(185): at android.view.LayoutInflater.createView(LayoutInflater.java:513)

03-26 22:59:31.784: ERROR/AndroidRuntime(185): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)

03-26 22:59:31.784: ERROR/AndroidRuntime(185): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)

03-26 22:59:31.784: ERROR/AndroidRuntime(185): at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)

03-26 22:59:31.784: ERROR/AndroidRuntime(185): at android.view.LayoutInflater.inflate(LayoutInflater.java:407)

03-26 22:59:31.784: ERROR/AndroidRuntime(185): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)

03-26 22:59:31.784: ERROR/AndroidRuntime(185): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)

03-26 22:59:31.784: ERROR/AndroidRuntime(185): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198)

03-26 22:59:31.784: ERROR/AndroidRuntime(185): at android.app.Activity.setContentView(Activity.java:1622)

03-26 22:59:31.784: ERROR/AndroidRuntime(185): at kz.androidmarket.www.randomtest1.randomTest1.onCreate(randomTest1.java:11)

03-26 22:59:31.784: ERROR/AndroidRuntime(185): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)

03-26 22:59:31.784: ERROR/AndroidRuntime(185): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459)

03-26 22:59:31.784: ERROR/AndroidRuntime(185): ... 11 more

03-26 22:59:31.784: ERROR/AndroidRuntime(185): Caused by: java.lang.reflect.InvocationTargetException

03-26 22:59:31.784: ERROR/AndroidRuntime(185): at android.widget.TextView.(TextView.java:320)

03-26 22:59:31.784: ERROR/AndroidRuntime(185): at java.lang.reflect.Constructor.constructNative(Native Method)

03-26 22:59:31.784: ERROR/AndroidRuntime(185): at java.lang.reflect.Constructor.newInstance(Constructor.java:446)

03-26 22:59:31.784: ERROR/AndroidRuntime(185): at android.view.LayoutInflater.createView(LayoutInflater.java:500)

03-26 22:59:31.784: ERROR/AndroidRuntime(185): ... 22 more

03-26 22:59:31.784: ERROR/AndroidRuntime(185): Caused by: android.content.res.Resources$NotFoundException: File #ffff9900 from drawable resource ID #0x7f040002: .xml extension required

03-26 22:59:31.784: ERROR/AndroidRuntime(185): at android.content.res.Resources.loadColorStateList(Resources.java:1820)

03-26 22:59:31.784: ERROR/AndroidRuntime(185): at android.content.res.TypedArray.getColorStateList(TypedArray.java:289)

03-26 22:59:31.784: ERROR/AndroidRuntime(185): at android.widget.TextView.(TextView.java:627)

03-26 22:59:31.784: ERROR/AndroidRuntime(185): ... 26 more


Could anybody help me?

© Stack Overflow or respective owner

Related posts about android

Related posts about debugging