android - Force Close error when changing from portrait to landscape -
i learning android programming book of ed brunette "hello,android"
in code(following) give , typed is, still force close error .
<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:background="@color/background" android:gravity="center" android:padding="35dip" > <textview android:text="@string/main_title" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_gravity="center" android:layout_marginbottom="20dip" android:textsize="24.5sp" /> <tablelayout android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_gravity="center" android:stretchcolumns="*"> <tablerow> <button android:id="@+id/continue_button" android:text="@string/continue_label"/> <button android:id="@+id/new_button" android:text="@string/new_game_label"/> </tablerow> <tablerow> <button android:id="@+id/about_button" android:text="@string/about_label" /> <button android:id="@+id/exit_button" androidltext="@string/exit_label" /> </tablerow> </tablelayout> </linearlayout>
the log cat:
04-01 15:12:08.370: d/androidruntime(410): shutting down vm 04-01 15:12:08.370: w/dalvikvm(410): threadid=1: thread exiting uncaught exception (group=0x40015560) 04-01 15:12:08.420: e/androidruntime(410): fatal exception: main 04-01 15:12:08.420: e/androidruntime(410): java.lang.runtimeexception: unable start activity componentinfo{org.example.sudoku/org.example.sudoku.sudoku}: android.view.inflateexception: binary xml file line #10: error inflating class textview 04-01 15:12:08.420: e/androidruntime(410): @ android.app.activitythread.performlaunchactivity(activitythread.java:1647) 04-01 15:12:08.420: e/androidruntime(410): @ android.app.activitythread.handlelaunchactivity(activitythread.java:1663) 04-01 15:12:08.420: e/androidruntime(410): @ android.app.activitythread.handlerelaunchactivity(activitythread.java:2832) 04-01 15:12:08.420: e/androidruntime(410): @ android.app.activitythread.access$1600(activitythread.java:117) 04-01 15:12:08.420: e/androidruntime(410): @ android.app.activitythread$h.handlemessage(activitythread.java:935) 04-01 15:12:08.420: e/androidruntime(410): @ android.os.handler.dispatchmessage(handler.java:99) 04-01 15:12:08.420: e/androidruntime(410): @ android.os.looper.loop(looper.java:123) 04-01 15:12:08.420: e/androidruntime(410): @ android.app.activitythread.main(activitythread.java:3683) 04-01 15:12:08.420: e/androidruntime(410): @ java.lang.reflect.method.invokenative(native method) 04-01 15:12:08.420: e/androidruntime(410): @ java.lang.reflect.method.invoke(method.java:507) 04-01 15:12:08.420: e/androidruntime(410): @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:839) 04-01 15:12:08.420: e/androidruntime(410): @ com.android.internal.os.zygoteinit.main(zygoteinit.java:597) 04-01 15:12:08.420: e/androidruntime(410): @ dalvik.system.nativestart.main(native method) 04-01 15:12:08.420: e/androidruntime(410): caused by: android.view.inflateexception: binary xml file line #10: error inflating class textview 04-01 15:12:08.420: e/androidruntime(410): @ android.view.layoutinflater.createviewfromtag(layoutinflater.java:581) 04-01 15:12:08.420: e/androidruntime(410): @ android.view.layoutinflater.rinflate(layoutinflater.java:623) 04-01 15:12:08.420: e/androidruntime(410): @ android.view.layoutinflater.inflate(layoutinflater.java:408) 04-01 15:12:08.420: e/androidruntime(410): @ android.view.layoutinflater.inflate(layoutinflater.java:320) 04-01 15:12:08.420: e/androidruntime(410): @ android.view.layoutinflater.inflate(layoutinflater.java:276) 04-01 15:12:08.420: e/androidruntime(410): @ com.android.internal.policy.impl.phonewindow.setcontentview(phonewindow.java:207) 04-01 15:12:08.420: e/androidruntime(410): @ android.app.activity.setcontentview(activity.java:1657) 04-01 15:12:08.420: e/androidruntime(410): @ org.example.sudoku.sudoku.oncreate(sudoku.java:11) 04-01 15:12:08.420: e/androidruntime(410): @ android.app.instrumentation.callactivityoncreate(instrumentation.java:1047) 04-01 15:12:08.420: e/androidruntime(410): @ android.app.activitythread.performlaunchactivity(activitythread.java:1611) 04-01 15:12:08.420: e/androidruntime(410): ... 12 more 04-01 15:12:08.420: e/androidruntime(410): caused by: java.lang.classnotfoundexception: android.view.textview in loader dalvik.system.pathclassloader[/data/app/org.example.sudoku-1.apk] 04-01 15:12:08.420: e/androidruntime(410): @ dalvik.system.pathclassloader.findclass(pathclassloader.java:240) 04-01 15:12:08.420: e/androidruntime(410): @ java.lang.classloader.loadclass(classloader.java:551) 04-01 15:12:08.420: e/androidruntime(410): @ java.lang.classloader.loadclass(classloader.java:511) 04-01 15:12:08.420: e/androidruntime(410): @ android.view.layoutinflater.createview(layoutinflater.java:471) 04-01 15:12:08.420: e/androidruntime(410): @ android.view.layoutinflater.oncreateview(layoutinflater.java:549) 04-01 15:12:08.420: e/androidruntime(410): @ com.android.internal.policy.impl.phonelayoutinflater.oncreateview(phonelayoutinflater.java:66) 04-01 15:12:08.420: e/androidruntime(410): @ android.view.layoutinflater.createviewfromtag(layoutinflater.java:568) 04-01 15:12:08.420: e/androidruntime(410): ... 21 more 04-01 15:12:12.681: i/process(410): sending signal. pid: 410 sig: 9 04-01 15:12:34.881: w/keycharactermap(424): no keyboard id 0 04-01 15:12:34.881: w/keycharactermap(424): using default keymap: /system/usr/keychars/qwerty.kcm.bin 04-01 15:30:15.661: d/androidruntime(495): shutting down vm 04-01 15:30:15.661: w/dalvikvm(495): threadid=1: thread exiting uncaught exception (group=0x40015560) 04-01 15:30:15.741: e/androidruntime(495): fatal exception: main 04-01 15:30:15.741: e/androidruntime(495): java.lang.runtimeexception: unable start activity componentinfo{org.example.sudoku/org.example.sudoku.sudoku}: android.view.inflateexception: binary xml file line #10: error inflating class textview 04-01 15:30:15.741: e/androidruntime(495): @ android.app.activitythread.performlaunchactivity(activitythread.java:1647) 04-01 15:30:15.741: e/androidruntime(495): @ android.app.activitythread.handlelaunchactivity(activitythread.java:1663) 04-01 15:30:15.741: e/androidruntime(495): @ android.app.activitythread.handlerelaunchactivity(activitythread.java:2832) 04-01 15:30:15.741: e/androidruntime(495): @ android.app.activitythread.access$1600(activitythread.java:117) 04-01 15:30:15.741: e/androidruntime(495): @ android.app.activitythread$h.handlemessage(activitythread.java:935) 04-01 15:30:15.741: e/androidruntime(495): @ android.os.handler.dispatchmessage(handler.java:99) 04-01 15:30:15.741: e/androidruntime(495): @ android.os.looper.loop(looper.java:123) 04-01 15:30:15.741: e/androidruntime(495): @ android.app.activitythread.main(activitythread.java:3683) 04-01 15:30:15.741: e/androidruntime(495): @ java.lang.reflect.method.invokenative(native method) 04-01 15:30:15.741: e/androidruntime(495): @ java.lang.reflect.method.invoke(method.java:507) 04-01 15:30:15.741: e/androidruntime(495): @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:839) 04-01 15:30:15.741: e/androidruntime(495): @ com.android.internal.os.zygoteinit.main(zygoteinit.java:597) 04-01 15:30:15.741: e/androidruntime(495): @ dalvik.system.nativestart.main(native method) 04-01 15:30:15.741: e/androidruntime(495): caused by: android.view.inflateexception: binary xml file line #10: error inflating class textview 04-01 15:30:15.741: e/androidruntime(495): @ android.view.layoutinflater.createviewfromtag(layoutinflater.java:581) 04-01 15:30:15.741: e/androidruntime(495): @ android.view.layoutinflater.rinflate(layoutinflater.java:623) 04-01 15:30:15.741: e/androidruntime(495): @ android.view.layoutinflater.inflate(layoutinflater.java:408) 04-01 15:30:15.741: e/androidruntime(495): @ android.view.layoutinflater.inflate(layoutinflater.java:320) 04-01 15:30:15.741: e/androidruntime(495): @ android.view.layoutinflater.inflate(layoutinflater.java:276) 04-01 15:30:15.741: e/androidruntime(495): @ com.android.internal.policy.impl.phonewindow.setcontentview(phonewindow.java:207) 04-01 15:30:15.741: e/androidruntime(495): @ android.app.activity.setcontentview(activity.java:1657) 04-01 15:30:15.741: e/androidruntime(495): @ org.example.sudoku.sudoku.oncreate(sudoku.java:11) 04-01 15:30:15.741: e/androidruntime(495): @ android.app.instrumentation.callactivityoncreate(instrumentation.java:1047) 04-01 15:30:15.741: e/androidruntime(495): @ android.app.activitythread.performlaunchactivity(activitythread.java:1611) 04-01 15:30:15.741: e/androidruntime(495): ... 12 more 04-01 15:30:15.741: e/androidruntime(495): caused by: java.lang.classnotfoundexception: android.view.textview in loader dalvik.system.pathclassloader[/data/app/org.example.sudoku-2.apk] 04-01 15:30:15.741: e/androidruntime(495): @ dalvik.system.pathclassloader.findclass(pathclassloader.java:240) 04-01 15:30:15.741: e/androidruntime(495): @ java.lang.classloader.loadclass(classloader.java:551) 04-01 15:30:15.741: e/androidruntime(495): @ java.lang.classloader.loadclass(classloader.java:511) 04-01 15:30:15.741: e/androidruntime(495): @ android.view.layoutinflater.createview(layoutinflater.java:471) 04-01 15:30:15.741: e/androidruntime(495): @ android.view.layoutinflater.oncreateview(layoutinflater.java:549) 04-01 15:30:15.741: e/androidruntime(495): @ com.android.internal.policy.impl.phonelayoutinflater.oncreateview(phonelayoutinflater.java:66) 04-01 15:30:15.741: e/androidruntime(495): @ android.view.layoutinflater.createviewfromtag(layoutinflater.java:568) 04-01 15:30:15.741: e/androidruntime(495): ... 21 more
i still learning , , searched other questions me problem, confused me still dont know android programming .
thanks :)
from logcat:
caused by: android.view.inflateexception: binary xml file line #10: error inflating class textview e/androidruntime(495): @ android.view.layoutinflater.createviewfromtag(layoutinflater.java:581)
so know text view problem.
<textview android:text="@string/main_title" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_gravity="center" android:layout_marginbottom="20dip" android:textsize="24.5sp" />
remove spaces before closing tag , change textview textview.
<textview android:text="@string/main_title" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_gravity="center" android:layout_marginbottom="20dip" android:textsize="24.5sp"/>
Comments
Post a Comment