Illegal State Exception - android

i have implemented the simple listview and i get the error as
03-28 11:24:58.148: E/ArrayAdapter(275): You must supply a resource ID for a TextView
03-28 11:24:58.156: D/AndroidRuntime(275): Shutting down VM
03-28 11:24:58.156: W/dalvikvm(275): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
03-28 11:24:58.249: E/AndroidRuntime(275): FATAL EXCEPTION: main
03-28 11:24:58.249: E/AndroidRuntime(275): java.lang.IllegalStateException: ArrayAdapter requires the resource ID to be a TextView
03-28 11:24:58.249: E/AndroidRuntime(275): at android.widget.ArrayAdapter.createViewFromResource(ArrayAdapter.java:347)
03-28 11:24:58.249: E/AndroidRuntime(275): at android.widget.ArrayAdapter.getView(ArrayAdapter.java:323)
03-28 11:24:58.249: E/AndroidRuntime(275): at android.widget.AbsListView.obtainView(AbsListView.java:1315)
03-28 11:24:58.249: E/AndroidRuntime(275): at android.widget.ListView.measureHeightOfChildren(ListView.java:1198)
03-28 11:24:58.249: E/AndroidRuntime(275): at android.widget.ListView.onMeasure(ListView.java:1109)
03-28 11:24:58.249: E/AndroidRuntime(275): at android.view.View.measure(View.java:8171)
03-28 11:24:58.249: E/AndroidRuntime(275): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3132)
03-28 11:24:58.249: E/AndroidRuntime(275): at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1012)
03-28 11:24:58.249: E/AndroidRuntime(275): at android.widget.LinearLayout.measureVertical(LinearLayout.java:381)
03-28 11:24:58.249: E/AndroidRuntime(275): at android.widget.LinearLayout.onMeasure(LinearLayout.java:304)
03-28 11:24:58.249: E/AndroidRuntime(275): at android.view.View.measure(View.java:8171)
03-28 11:24:58.249: E/AndroidRuntime(275): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3132)
03-28 11:24:58.249: E/AndroidRuntime(275): at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
03-28 11:24:58.249: E/AndroidRuntime(275): at android.view.View.measure(View.java:8171)
03-28 11:24:58.249: E/AndroidRuntime(275): at android.widget.LinearLayout.measureVertical(LinearLayout.java:526)
03-28 11:24:58.249: E/AndroidRuntime(275): at android.widget.LinearLayout.onMeasure(LinearLayout.java:304)
03-28 11:24:58.249: E/AndroidRuntime(275): at android.view.View.measure(View.java:8171)
03-28 11:24:58.249: E/AndroidRuntime(275): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3132)
03-28 11:24:58.249: E/AndroidRuntime(275): at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
03-28 11:24:58.249: E/AndroidRuntime(275): at android.view.View.measure(View.java:8171)
03-28 11:24:58.249: E/AndroidRuntime(275): at android.view.ViewRoot.performTraversals(ViewRoot.java:801)
03-28 11:24:58.249: E/AndroidRuntime(275): at android.view.ViewRoot.handleMessage(ViewRoot.java:1727)
03-28 11:24:58.249: E/AndroidRuntime(275): at android.os.Handler.dispatchMessage(Handler.java:99)
03-28 11:24:58.249: E/AndroidRuntime(275): at android.os.Looper.loop(Looper.java:123)
03-28 11:24:58.249: E/AndroidRuntime(275): at android.app.ActivityThread.main(ActivityThread.java:4627)
03-28 11:24:58.249: E/AndroidRuntime(275): at java.lang.reflect.Method.invokeNative(Native Method)
03-28 11:24:58.249: E/AndroidRuntime(275): at java.lang.reflect.Method.invoke(Method.java:521)
03-28 11:24:58.249: E/AndroidRuntime(275): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
03-28 11:24:58.249: E/AndroidRuntime(275): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
03-28 11:24:58.249: E/AndroidRuntime(275): at dalvik.system.NativeStart.main(Native Method)
03-28 11:24:58.249: E/AndroidRuntime(275): Caused by: java.lang.ClassCastException: android.widget.RelativeLayout
03-28 11:24:58.249: E/AndroidRuntime(275): at android.widget.ArrayAdapter.createViewFromResource(ArrayAdapter.java:340)
03-28 11:24:58.249: E/AndroidRuntime(275): ... 29 more
03-28 11:24:58.249: E/AndroidRuntime(275): Caused by: java.lang.ClassCastException: android.widget.RelativeLayout
03-28 11:24:58.249: E/AndroidRuntime(275): at android.widget.ArrayAdapter.createViewFromResource(ArrayAdapter.java:340)
03-28 11:24:58.249: E/AndroidRuntime(275): ... 29 more
03-28 11:27:32.329: I/Process(275): Sending signal. PID: 275 SIG: 9

Seems you try to pass a RelativeLayout to your ArrayAdapter, where it expects a TextView. At least this is, what the exceptions say.

Related

android application stopped unexpectedly emulator

Couldn't able to find the error. Logcat Provided
03-22 00:08:15.677: E/dalvikvm(275): Could not find class 'net.sourceforge.jeval.Evaluator', referenced from method com.math.Mainactivitycalculator.onCreate
03-22 00:08:15.927: E/AndroidRuntime(275): FATAL EXCEPTION: main
03-22 00:08:15.927: E/AndroidRuntime(275): java.lang.NoClassDefFoundError: net.sourceforge.jeval.Evaluator
03-22 00:08:15.927: E/AndroidRuntime(275): at com.dbl.dothemath.Mainactivitycalculator.onCreate(Mainactivitycalculator.java:76)
03-22 00:08:15.927: E/AndroidRuntime(275): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
03-22 00:08:15.927: E/AndroidRuntime(275): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
03-22 00:08:15.927: E/AndroidRuntime(275): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
03-22 00:08:15.927: E/AndroidRuntime(275): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
03-22 00:08:15.927: E/AndroidRuntime(275): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
03-22 00:08:15.927: E/AndroidRuntime(275): at android.os.Handler.dispatchMessage(Handler.java:99)
03-22 00:08:15.927: E/AndroidRuntime(275): at android.os.Looper.loop(Looper.java:123)
03-22 00:08:15.927: E/AndroidRuntime(275): at android.app.ActivityThread.main(ActivityThread.java:4627)
03-22 00:08:15.927: E/AndroidRuntime(275): at java.lang.reflect.Method.invokeNative(Native Method)
03-22 00:08:15.927: E/AndroidRuntime(275): at java.lang.reflect.Method.invoke(Method.java:521)
03-22 00:08:15.927: E/AndroidRuntime(275): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
03-22 00:08:15.927: E/AndroidRuntime(275): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
03-22 00:08:15.927: E/AndroidRuntime(275): at dalvik.system.NativeStart.main(Native Method)
mathematical Expression involving numbers.
Numbers are treated as doubles, so resulting numbers will contain at least one decimal place.
string String can also be added together, compared, etc...
Boolean Expression that evaluate to true (1.0) and false (0.0).
functional Custom functions can be created or there are many Math and String functions that JEval supplies with this class.

Run emulator on Eclipse i have this error

when i run an application on Eclipse show me this message (the program has stop unexpectedly please try again later ) force stop and i have this error exception:
11-29 17:22:18.893: D/AndroidRuntime(275): Shutting down VM
11-29 17:22:18.893: W/dalvikvm(275): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
11-29 17:22:18.923: E/AndroidRuntime(275): FATAL EXCEPTION: main
11-29 17:22:18.923: E/AndroidRuntime(275): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.progress_bar/com.example.progress_bar.MainActivity}: java.lang.ClassNotFoundException: com.example.progress_bar.MainActivity in loader dalvik.system.PathClassLoader[/data/app/com.example.progress_bar-1.apk]
11-29 17:22:18.923: E/AndroidRuntime(275): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2585)
11-29 17:22:18.923: E/AndroidRuntime(275): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
11-29 17:22:18.923: E/AndroidRuntime(275): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
11-29 17:22:18.923: E/AndroidRuntime(275): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
11-29 17:22:18.923: E/AndroidRuntime(275): at android.os.Handler.dispatchMessage(Handler.java:99)
11-29 17:22:18.923: E/AndroidRuntime(275): at android.os.Looper.loop(Looper.java:123)
11-29 17:22:18.923: E/AndroidRuntime(275): at android.app.ActivityThread.main(ActivityThread.java:4627)
11-29 17:22:18.923: E/AndroidRuntime(275): at java.lang.reflect.Method.invokeNative(Native Method)
11-29 17:22:18.923: E/AndroidRuntime(275): at java.lang.reflect.Method.invoke(Method.java:521)
11-29 17:22:18.923: E/AndroidRuntime(275): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
11-29 17:22:18.923: E/AndroidRuntime(275): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
11-29 17:22:18.923: E/AndroidRuntime(275): at dalvik.system.NativeStart.main(Native Method)
11-29 17:22:18.923: E/AndroidRuntime(275): Caused by: java.lang.ClassNotFoundException: com.example.progress_bar.MainActivity in loader dalvik.system.PathClassLoader[/data/app/com.example.progress_bar-1.apk]
11-29 17:22:18.923: E/AndroidRuntime(275): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
11-29 17:22:18.923: E/AndroidRuntime(275): at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
11-29 17:22:18.923: E/AndroidRuntime(275): at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
11-29 17:22:18.923: E/AndroidRuntime(275): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
11-29 17:22:18.923: E/AndroidRuntime(275): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
11-29 17:22:18.923: E/AndroidRuntime(275): ... 11 more
Can you post your MainActivity.xml? And i'd recommend when you create a project to rename your com.example.appname to something like app.appname. Play Store doesn't accept the com.example prefix.

ClassNotFoundException when running an android app

I'm trying to run the Spydroid app from . But run into a "Unfortunately Spydroid has stopped" as soon as it runs on my Nexus 4.
I used egit to grab a copy of the code into a new project in eclipse. At that point, it threw out a couple errors telling me to right click on the project and select Android Tools --> Fix Project Properties. I did as it said and then hit run, which uploads it to the Nexus 4, installs it and when it attempts to run is when I get the crash.
Am I doing something wrong in the checkout/setup process?
I posted a similar post to the project's google code page
Logcat:
03-28 02:59:20.028: D/AndroidRuntime(31294): Shutting down VM
03-28 02:59:20.028: W/dalvikvm(31294): threadid=1: thread exiting with uncaught exception (group=0x41920930)
03-28 02:59:20.028: E/AndroidRuntime(31294): FATAL EXCEPTION: main
03-28 02:59:20.028: E/AndroidRuntime(31294): java.lang.RuntimeException: Unable to instantiate application net.majorkernelpanic.spydroid.SpydroidApplication: java.lang.ClassNotFoundException: Didn't find class "net.majorkernelpanic.spydroid.SpydroidApplication" on path: /data/app/net.majorkernelpanic.spydroid-1.apk
03-28 02:59:20.028: E/AndroidRuntime(31294): at android.app.LoadedApk.makeApplication(LoadedApk.java:504)
03-28 02:59:20.028: E/AndroidRuntime(31294): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4364)
03-28 02:59:20.028: E/AndroidRuntime(31294): at android.app.ActivityThread.access$1300(ActivityThread.java:141)
03-28 02:59:20.028: E/AndroidRuntime(31294): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1294)
03-28 02:59:20.028: E/AndroidRuntime(31294): at android.os.Handler.dispatchMessage(Handler.java:99)
03-28 02:59:20.028: E/AndroidRuntime(31294): at android.os.Looper.loop(Looper.java:137)
03-28 02:59:20.028: E/AndroidRuntime(31294): at android.app.ActivityThread.main(ActivityThread.java:5041)
03-28 02:59:20.028: E/AndroidRuntime(31294): at java.lang.reflect.Method.invokeNative(Native Method)
03-28 02:59:20.028: E/AndroidRuntime(31294): at java.lang.reflect.Method.invoke(Method.java:511)
03-28 02:59:20.028: E/AndroidRuntime(31294): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
03-28 02:59:20.028: E/AndroidRuntime(31294): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
03-28 02:59:20.028: E/AndroidRuntime(31294): at dalvik.system.NativeStart.main(Native Method)
03-28 02:59:20.028: E/AndroidRuntime(31294): Caused by: java.lang.ClassNotFoundException: Didn't find class "net.majorkernelpanic.spydroid.SpydroidApplication" on path: /data/app/net.majorkernelpanic.spydroid-1.apk
03-28 02:59:20.028: E/AndroidRuntime(31294): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
03-28 02:59:20.028: E/AndroidRuntime(31294): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
03-28 02:59:20.028: E/AndroidRuntime(31294): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
03-28 02:59:20.028: E/AndroidRuntime(31294): at android.app.Instrumentation.newApplication(Instrumentation.java:968)
03-28 02:59:20.028: E/AndroidRuntime(31294): at android.app.LoadedApk.makeApplication(LoadedApk.java:499)
03-28 02:59:20.028: E/AndroidRuntime(31294): ... 11 more
Possible error can be:
Check the package name carefully
Check order/export option in Build Path

android application force close while start

Trying to develop hello world, but getting force close error on emulator. thanks in advance
07-25 12:04:12.308: D/AndroidRuntime(277): Shutting down VM
07-25 12:04:12.308: W/dalvikvm(277): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
07-25 12:04:12.368: E/AndroidRuntime(277): FATAL EXCEPTION: main
07-25 12:04:12.368: E/AndroidRuntime(277): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.exampe.helloww/com.exampe.helloww.HelloActivity}: java.lang.ClassNotFoundException: com.exampe.helloww.HelloActivity in loader dalvik.system.PathClassLoader[/data/app/com.exampe.helloww-2.apk]
07-25 12:04:12.368: E/AndroidRuntime(277): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2585)
07-25 12:04:12.368: E/AndroidRuntime(277): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
07-25 12:04:12.368: E/AndroidRuntime(277): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
07-25 12:04:12.368: E/AndroidRuntime(277): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
07-25 12:04:12.368: E/AndroidRuntime(277): at android.os.Handler.dispatchMessage(Handler.java:99)
07-25 12:04:12.368: E/AndroidRuntime(277): at android.os.Looper.loop(Looper.java:123)
07-25 12:04:12.368: E/AndroidRuntime(277): at android.app.ActivityThread.main(ActivityThread.java:4627)
07-25 12:04:12.368: E/AndroidRuntime(277): at java.lang.reflect.Method.invokeNative(Native Method)
07-25 12:04:12.368: E/AndroidRuntime(277): at java.lang.reflect.Method.invoke(Method.java:521)
07-25 12:04:12.368: E/AndroidRuntime(277): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
07-25 12:04:12.368: E/AndroidRuntime(277): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
07-25 12:04:12.368: E/AndroidRuntime(277): at dalvik.system.NativeStart.main(Native Method)
07-25 12:04:12.368: E/AndroidRuntime(277): Caused by: java.lang.ClassNotFoundException: com.exampe.helloww.HelloActivity in loader dalvik.system.PathClassLoader[/data/app/com.exampe.helloww-2.apk]
07-25 12:04:12.368: E/AndroidRuntime(277): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
07-25 12:04:12.368: E/AndroidRuntime(277): at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
07-25 12:04:12.368: E/AndroidRuntime(277): at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
07-25 12:04:12.368: E/AndroidRuntime(277): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
07-25 12:04:12.368: E/AndroidRuntime(277): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
07-25 12:04:12.368: E/AndroidRuntime(277): ... 11 more
07-25 12:04:17.158: I/Process(277): Sending signal. PID: 277 SIG: 9
the ClassNotFoundException is usually caused when you try to run your app on lower sdk version than the target sdk
Add your HelloActivity in Manifest file.Due to this your Activity is not found and you are getting ClassNotFoundException as
E/AndroidRuntime(277): Caused by: java.lang.ClassNotFoundException: com.exampe.helloww.HelloActivity

ResourcesNotFoundException when initialising Drawable

private Drawable drawable;
drawable = this.getResources().getDrawable(R.drawable.icon);
When I run this on my htc desire it goes, but on emulator it crashes when I try to initialiser drawable. Why is this?
edit: here is my stacktrace
03-28 13:27:58.453: ERROR/ActivityThread(888): Failed to find provider info for com.google.settings
03-28 13:28:06.414: ERROR/AndroidRuntime(888): Uncaught handler: thread main exiting due to uncaught exception
03-28 13:28:06.486: ERROR/AndroidRuntime(888): java.lang.RuntimeException: Unable to start activity ComponentInfo{be.test.helloworld/be.test.helloworld.MyMapActivityII}: android.content.res.Resources$NotFoundException: Resource ID #0x7f020000
03-28 13:28:06.486: ERROR/AndroidRuntime(888): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2268)
03-28 13:28:06.486: ERROR/AndroidRuntime(888): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2284)
03-28 13:28:06.486: ERROR/AndroidRuntime(888): at android.app.ActivityThread.access$1800(ActivityThread.java:112)
03-28 13:28:06.486: ERROR/AndroidRuntime(888): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1692)
03-28 13:28:06.486: ERROR/AndroidRuntime(888): at android.os.Handler.dispatchMessage(Handler.java:99)
03-28 13:28:06.486: ERROR/AndroidRuntime(888): at android.os.Looper.loop(Looper.java:123)
03-28 13:28:06.486: ERROR/AndroidRuntime(888): at android.app.ActivityThread.main(ActivityThread.java:3948)
03-28 13:28:06.486: ERROR/AndroidRuntime(888): at java.lang.reflect.Method.invokeNative(Native Method)
03-28 13:28:06.486: ERROR/AndroidRuntime(888): at java.lang.reflect.Method.invoke(Method.java:521)
03-28 13:28:06.486: ERROR/AndroidRuntime(888): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:782)
03-28 13:28:06.486: ERROR/AndroidRuntime(888): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
03-28 13:28:06.486: ERROR/AndroidRuntime(888): at dalvik.system.NativeStart.main(Native Method)
03-28 13:28:06.486: ERROR/AndroidRuntime(888): Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x7f020000
03-28 13:28:06.486: ERROR/AndroidRuntime(888): at android.content.res.Resources.getValue(Resources.java:846)
03-28 13:28:06.486: ERROR/AndroidRuntime(888): at android.content.res.Resources.getDrawable(Resources.java:534)
03-28 13:28:06.486: ERROR/AndroidRuntime(888): at be.test.helloworld.MyMapActivityII.initOverlays(MyMapActivityII.java:44)
03-28 13:28:06.486: ERROR/AndroidRuntime(888): at be.test.helloworld.MyMapActivityII.onCreate(MyMapActivityII.java:38)
03-28 13:28:06.486: ERROR/AndroidRuntime(888): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1123)
03-28 13:28:06.486: ERROR/AndroidRuntime(888): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2231)
03-28 13:28:06.486: ERROR/AndroidRuntime(888): ... 11 more
Make sure you have an icon in all of the drawable folders (drawable-ldpi, drawable-mdpi and drawable-hdpi)

Categories

Resources