I have a neo4j server running on my laptop on the port 7474. It is enabled to listen on localhost:7474/ , 0.0.0.0:7474/ and :7474/. I am referring to the official documentation on the Community Documentation Page - http://docs.neo4j.org/chunked/milestone/server-java-rest-client-example.html.
I am trying to connect to the database and create a node through an android app.
I have added the jersey-bundle-1.8.jar in my app's libs folder. I am able to use all the functions defined in the library. No errors are reported for calling the functions.
Using the documentation, i am able to connect to the neo4j server running on my laptop as shown in the picture.
ISSUE FACED :
So moving ahead, i clicked the button to create a node, again picking the code from the reference page mentioned above.
What happened was that the app crashed and raised exceptions (as shown in the picture). The exceptions raised are attached in log
03-28 17:50:05.691: I/SurfaceTextureClient(10165): [STC::queueBuffer] (this:0x5cc8a588) fps:0.09, dur:10766.62, max:10766.62, min:10766.62
03-28 17:50:05.691: I/SurfaceTextureClient(10165): [STC::queueBuffer] this:0x5cc8a588, api:1, last queue time elapsed:10766.62
03-28 17:50:05.709: D/dalvikvm(10165): GC_CONCURRENT freed 272K, 16% free 5656K/6664K, paused 2ms+2ms, total 27ms
03-28 17:50:05.747: V/Provider/Settings(10165): invalidate [system]: current 208 != cached 0
03-28 17:50:05.750: V/Provider/Settings(10165): from db cache, name = sound_effects_enabled , value = 0
03-28 17:50:05.751: D/dalvikvm(10165): create interp thread : stack size=32KB
03-28 17:50:05.751: D/dalvikvm(10165): create new thread
03-28 17:50:05.751: D/dalvikvm(10165): new thread created
03-28 17:50:05.751: D/dalvikvm(10165): update thread list
03-28 17:50:05.751: D/dalvikvm(10165): threadid=12: interp stack at 0x5e2ef000
03-28 17:50:05.751: D/dalvikvm(10165): threadid=12: created from interp
03-28 17:50:05.751: D/dalvikvm(10165): start new thread
03-28 17:50:05.751: D/dalvikvm(10165): threadid=12: notify debugger
03-28 17:50:05.751: D/dalvikvm(10165): threadid=12 (AsyncTask #1): calling run()
03-28 17:50:05.768: I/dalvikvm(10165): Failed resolving Lcom/sun/jersey/core/osgi/OsgiRegistry; interface 2320 'Lorg/osgi/framework/SynchronousBundleListener;'
03-28 17:50:05.768: W/dalvikvm(10165): Link of class 'Lcom/sun/jersey/core/osgi/OsgiRegistry;' failed
03-28 17:50:05.768: I/dalvikvm(10165): Could not find method com.sun.jersey.core.osgi.OsgiRegistry.getInstance, referenced from method com.sun.jersey.core.reflection.ReflectionHelper.getOsgiRegistryInstance
03-28 17:50:05.768: W/dalvikvm(10165): VFY: unable to resolve static method 7747: Lcom/sun/jersey/core/osgi/OsgiRegistry;.getInstance ()Lcom/sun/jersey/core/osgi/OsgiRegistry;
03-28 17:50:05.768: D/dalvikvm(10165): VFY: replacing opcode 0x71 at 0x0008
03-28 17:50:05.769: I/dalvikvm(10165): Failed resolving Lcom/sun/jersey/core/osgi/OsgiRegistry; interface 2320 'Lorg/osgi/framework/SynchronousBundleListener;'
03-28 17:50:05.769: W/dalvikvm(10165): Link of class 'Lcom/sun/jersey/core/osgi/OsgiRegistry;' failed
03-28 17:50:05.770: W/dalvikvm(10165): VFY: unable to find class referenced in signature (Lcom/sun/jersey/core/osgi/OsgiRegistry;)
03-28 17:50:05.835: D/dalvikvm(10165): GC_CONCURRENT freed 359K, 17% free 5690K/6784K, paused 3ms+3ms, total 20ms
03-28 17:50:05.862: D/dalvikvm(10165): create interp thread : stack size=32KB
03-28 17:50:05.862: D/dalvikvm(10165): create new thread
03-28 17:50:05.862: D/dalvikvm(10165): new thread created
03-28 17:50:05.862: D/dalvikvm(10165): update thread list
03-28 17:50:05.862: D/dalvikvm(10165): threadid=13: interp stack at 0x5e2fb000
03-28 17:50:05.862: D/dalvikvm(10165): threadid=13: created from interp
03-28 17:50:05.863: D/dalvikvm(10165): start new thread
03-28 17:50:05.863: D/dalvikvm(10165): threadid=12: exiting
03-28 17:50:05.863: W/dalvikvm(10165): threadid=12: thread exiting with uncaught exception (group=0x41dba9a8)
03-28 17:50:05.863: W/System.err(10165): java.util.concurrent.ExecutionException: com.sun.jersey.api.client.ClientHandlerException: com.sun.jersey.api.client.ClientHandlerException: A message body writer for Java type, class java.lang.String, and MIME media type, application/json, was not found
03-28 17:50:05.864: D/dalvikvm(10165): threadid=13: notify debugger
03-28 17:50:05.864: W/System.err(10165): at java.util.concurrent.FutureTask.report(FutureTask.java:94)
03-28 17:50:05.864: D/dalvikvm(10165): threadid=13 (AsyncTask #2): calling run()
03-28 17:50:05.865: W/System.err(10165): at java.util.concurrent.FutureTask.get(FutureTask.java:160)
03-28 17:50:05.865: W/System.err(10165): at android.os.AsyncTask.get(AsyncTask.java:482)
03-28 17:50:05.865: W/System.err(10165): at com.example.neo4j.MainActivity$2.onClick(MainActivity.java:50)
03-28 17:50:05.865: W/System.err(10165): at android.view.View.performClick(View.java:4209)
03-28 17:50:05.865: W/System.err(10165): at android.view.View$PerformClick.run(View.java:17431)
03-28 17:50:05.866: W/System.err(10165): at android.os.Handler.handleCallback(Handler.java:725)
03-28 17:50:05.866: W/System.err(10165): at android.os.Handler.dispatchMessage(Handler.java:92)
03-28 17:50:05.866: W/System.err(10165): at android.os.Looper.loop(Looper.java:153)
03-28 17:50:05.866: W/System.err(10165): at android.app.ActivityThread.main(ActivityThread.java:5297)
03-28 17:50:05.866: W/System.err(10165): at java.lang.reflect.Method.invokeNative(Native Method)
03-28 17:50:05.866: W/System.err(10165): at java.lang.reflect.Method.invoke(Method.java:511)
03-28 17:50:05.866: W/System.err(10165): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833)
03-28 17:50:05.867: W/System.err(10165): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
03-28 17:50:05.867: W/System.err(10165): at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:115)
03-28 17:50:05.867: W/System.err(10165): at dalvik.system.NativeStart.main(Native Method)
03-28 17:50:05.867: W/System.err(10165): Caused by: com.sun.jersey.api.client.ClientHandlerException: com.sun.jersey.api.client.ClientHandlerException: A message body writer for Java type, class java.lang.String, and MIME media type, application/json, was not found
03-28 17:50:05.868: W/System.err(10165): at com.sun.jersey.client.urlconnection.URLConnectionClientHandler.handle(URLConnectionClientHandler.java:155)
03-28 17:50:05.868: W/System.err(10165): at com.sun.jersey.api.client.Client.handle(Client.java:652)
03-28 17:50:05.868: W/System.err(10165): at com.sun.jersey.api.client.WebResource.handle(WebResource.java:682)
03-28 17:50:05.869: W/System.err(10165): at com.sun.jersey.api.client.WebResource.access$200(WebResource.java:74)
03-28 17:50:05.869: W/System.err(10165): at com.sun.jersey.api.client.WebResource$Builder.post(WebResource.java:560)
03-28 17:50:05.869: W/System.err(10165): at com.example.neo4j.RESTCreateNode.doInBackground(RESTCreateNode.java:33)
03-28 17:50:05.869: W/System.err(10165): at com.example.neo4j.RESTCreateNode.doInBackground(RESTCreateNode.java:1)
03-28 17:50:05.869: W/System.err(10165): at android.os.AsyncTask$2.call(AsyncTask.java:287)
03-28 17:50:05.869: W/System.err(10165): at java.util.concurrent.FutureTask.run(FutureTask.java:234)
03-28 17:50:05.870: W/System.err(10165): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
03-28 17:50:05.870: W/System.err(10165): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
03-28 17:50:05.870: W/System.err(10165): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
03-28 17:50:05.870: W/System.err(10165): at java.lang.Thread.run(Thread.java:838)
03-28 17:50:05.870: W/System.err(10165): Caused by: com.sun.jersey.api.client.ClientHandlerException: A message body writer for Java type, class java.lang.String, and MIME media type, application/json, was not found
03-28 17:50:05.871: W/System.err(10165): at com.sun.jersey.api.client.RequestWriter.writeRequestEntity(RequestWriter.java:288)
03-28 17:50:05.871: W/System.err(10165): at com.sun.jersey.client.urlconnection.URLConnectionClientHandler._invoke(URLConnectionClientHandler.java:217)
03-28 17:50:05.871: W/System.err(10165): at com.sun.jersey.client.urlconnection.URLConnectionClientHandler.handle(URLConnectionClientHandler.java:153)
03-28 17:50:05.871: W/System.err(10165): ... 12 more
03-28 17:50:05.879: E/AndroidRuntime(10165): FATAL EXCEPTION: AsyncTask #1
03-28 17:50:05.879: E/AndroidRuntime(10165): java.lang.RuntimeException: An error occured while executing doInBackground()
03-28 17:50:05.879: E/AndroidRuntime(10165): at android.os.AsyncTask$3.done(AsyncTask.java:299)
03-28 17:50:05.879: E/AndroidRuntime(10165): at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:352)
03-28 17:50:05.879: E/AndroidRuntime(10165): at java.util.concurrent.FutureTask.setException(FutureTask.java:219)
03-28 17:50:05.879: E/AndroidRuntime(10165): at java.util.concurrent.FutureTask.run(FutureTask.java:239)
03-28 17:50:05.879: E/AndroidRuntime(10165): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
03-28 17:50:05.879: E/AndroidRuntime(10165): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
03-28 17:50:05.879: E/AndroidRuntime(10165): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
03-28 17:50:05.879: E/AndroidRuntime(10165): at java.lang.Thread.run(Thread.java:838)
03-28 17:50:05.879: E/AndroidRuntime(10165): Caused by: com.sun.jersey.api.client.ClientHandlerException: com.sun.jersey.api.client.ClientHandlerException: A message body writer for Java type, class java.lang.String, and MIME media type, application/json, was not found
03-28 17:50:05.879: E/AndroidRuntime(10165): at com.sun.jersey.client.urlconnection.URLConnectionClientHandler.handle(URLConnectionClientHandler.java:155)
03-28 17:50:05.879: E/AndroidRuntime(10165): at com.sun.jersey.api.client.Client.handle(Client.java:652)
03-28 17:50:05.879: E/AndroidRuntime(10165): at com.sun.jersey.api.client.WebResource.handle(WebResource.java:682)
03-28 17:50:05.879: E/AndroidRuntime(10165): at com.sun.jersey.api.client.WebResource.access$200(WebResource.java:74)
03-28 17:50:05.879: E/AndroidRuntime(10165): at com.sun.jersey.api.client.WebResource$Builder.post(WebResource.java:560)
03-28 17:50:05.879: E/AndroidRuntime(10165): at com.example.neo4j.RESTCreateNode.doInBackground(RESTCreateNode.java:33)
03-28 17:50:05.879: E/AndroidRuntime(10165): at com.example.neo4j.RESTCreateNode.doInBackground(RESTCreateNode.java:1)
03-28 17:50:05.879: E/AndroidRuntime(10165): at android.os.AsyncTask$2.call(AsyncTask.java:287)
03-28 17:50:05.879: E/AndroidRuntime(10165): at java.util.concurrent.FutureTask.run(FutureTask.java:234)
03-28 17:50:05.879: E/AndroidRuntime(10165): ... 4 more
03-28 17:50:05.879: E/AndroidRuntime(10165): Caused by: com.sun.jersey.api.client.ClientHandlerException: A message body writer for Java type, class java.lang.String, and MIME media type, application/json, was not found
03-28 17:50:05.879: E/AndroidRuntime(10165): at com.sun.jersey.api.client.RequestWriter.writeRequestEntity(RequestWriter.java:288)
03-28 17:50:05.879: E/AndroidRuntime(10165): at com.sun.jersey.client.urlconnection.URLConnectionClientHandler._invoke(URLConnectionClientHandler.java:217)
03-28 17:50:05.879: E/AndroidRuntime(10165): at com.sun.jersey.client.urlconnection.URLConnectionClientHandler.handle(URLConnectionClientHandler.java:153)
03-28 17:50:05.879: E/AndroidRuntime(10165): ... 12 more
03-28 17:50:06.425: D/OpenGLRenderer(10165): Flushing caches (mode 0)
03-28 17:50:06.654: D/OpenGLRenderer(10165): Flushing caches (mode 1)
03-28 17:50:06.666: D/OpenGLRenderer(10165): Flushing caches (mode 0)
I started googling the issue and found a solution proposed by user Lucas Ventura
here - http://jersey.576304.n2.nabble.com/java-lang-NullPointerException-on-Android-td4212447.html
I implemented the solution and it started giving me exception -
"NullPointerException at MediaType.java:119".
I tried googling further but it didn't yeild anything useful.
A little insight on this topic would help me a lot.
Please let me know if i am following something in a wrong manner. If not, is there any other approach that I can use to connect to neo4j server in a RESTful way.
Also let me know if this is the answer i am looking for -https://github.com/giorgio-zamparelli/jersey-android
Related
I am updating my fragment from sqlite when getting push notification from server when i was on same fragment it's update. But when i was on another activity and getting push notification my application is crashing.
Here is my exception :
03-28 22:18:03.302: E/AndroidRuntime(17631): FATAL EXCEPTION: main
03-28 22:18:03.302: E/AndroidRuntime(17631): Process: com.newt.vdsi.driver, PID: 17631
03-28 22:18:03.302: E/AndroidRuntime(17631): java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
03-28 22:18:03.302: E/AndroidRuntime(17631): at android.support.v4.app.FragmentManagerImpl.checkStateLoss(FragmentManager.java:1360)
03-28 22:18:03.302: E/AndroidRuntime(17631): at android.support.v4.app.FragmentManagerImpl.enqueueAction(FragmentManager.java:1378)
03-28 22:18:03.302: E/AndroidRuntime(17631): at android.support.v4.app.BackStackRecord.commitInternal(BackStackRecord.java:595)
03-28 22:18:03.302: E/AndroidRuntime(17631): at android.support.v4.app.BackStackRecord.commit(BackStackRecord.java:574)
03-28 22:18:03.302: E/AndroidRuntime(17631): at com.newt.vdsi.driver.Home$1.onReceive(Home.java:517)
03-28 22:18:03.302: E/AndroidRuntime(17631): at android.support.v4.content.LocalBroadcastManager.executePendingBroadcasts(LocalBroadcastManager.java:297)
03-28 22:18:03.302: E/AndroidRuntime(17631): at android.support.v4.content.LocalBroadcastManager.access$000(LocalBroadcastManager.java:46)
03-28 22:18:03.302: E/AndroidRuntime(17631): at android.support.v4.content.LocalBroadcastManager$1.handleMessage(LocalBroadcastManager.java:116)
03-28 22:18:03.302: E/AndroidRuntime(17631): at android.os.Handler.dispatchMessage(Handler.java:102)
03-28 22:18:03.302: E/AndroidRuntime(17631): at android.os.Looper.loop(Looper.java:136)
03-28 22:18:03.302: E/AndroidRuntime(17631): at android.app.ActivityThread.main(ActivityThread.java:5086)
03-28 22:18:03.302: E/AndroidRuntime(17631): at java.lang.reflect.Method.invokeNative(Native Method)
03-28 22:18:03.302: E/AndroidRuntime(17631): at java.lang.reflect.Method.invoke(Method.java:515)
03-28 22:18:03.302: E/AndroidRuntime(17631): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
03-28 22:18:03.302: E/AndroidRuntime(17631): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
03-28 22:18:03.302: E/AndroidRuntime(17631): at dalvik.system.NativeStart.main(Native Method)
Thank in advance.
This usually happens when the host activity for that fragment has performed onStop() and a commit() is called on a FragmentTransaction after that has happened(that is your when commit is called and your host activity is hidden).
Try using a local broadcast with a custom intent filter when push notification is received and use a broadcast receiver in your fragment for the update logic.
In which case if the fragment is visible when push notification happens it'll update otherwise let its onCreateView() handle the logic.
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
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.
I have written for tables creation but when i am trying to access the table from one of my screen its throwing exception .
Even when i went do shell in commannd prompt i was not able to find that table . Any clue that i need to do .
logs :
W/System.err( 275): at java.lang.Thread.run(Thread.java:1096)
I/Database( 275): sqlite returned: error code = 1, msg = no such table: woman_registration
D/AndroidRuntime( 275): Shutting down VM
W/dalvikvm( 275): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
E/AndroidRuntime( 275): FATAL EXCEPTION: main
E/AndroidRuntime( 275): android.database.sqlite.SQLiteException: no such table: woman_registration: , while compiling: SELECT DISTINCT
* FROM woman_registration WHERE (m_name = ? AND f_name = ? and m_age_range = ?)
E/AndroidRuntime( 275): at android.database.sqlite.SQLiteCompiledSql.native_compile(Native Method)
E/AndroidRuntime( 275): at android.database.sqlite.SQLiteCompiledSql.compile(SQLiteCompiledSql.java:91)
E/AndroidRuntime( 275): at android.database.sqlite.SQLiteCompiledSql.<init>(SQLiteCompiledSql.java:64)
E/AndroidRuntime( 275): at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:80)
E/AndroidRuntime( 275): at android.database.sqlite.SQLiteQuery.<init>(SQLiteQuery.java:46)
E/AndroidRuntime( 275): at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:42)
E/AndroidRuntime( 275): at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1345)
E/AndroidRuntime( 275): at android.database.sqlite.SQLiteDatabase.queryWithFactory(SQLiteDatabase.java:1229)
E/AndroidRuntime( 275): at android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1184)
E/AndroidRuntime( 275): at org.atl.db.DBAdapter.isWomanAlreadyRegisgtered(DBAdapter.java:376)
E/AndroidRuntime( 275): at com.accenturelabs.idoc.RegisterWoman.registerMother(RegisterWoman.java:237)
E/AndroidRuntime( 275): at com.accenturelabs.idoc.RegisterWoman.access$1(RegisterWoman.java:223)
E/AndroidRuntime( 275): at com.accenturelabs.idoc.RegisterWoman$4.onClick(RegisterWoman.java:141)
E/AndroidRuntime( 275): at android.view.View.performClick(View.java:2408)
E/AndroidRuntime( 275): at android.view.View$PerformClick.run(View.java:8816)
E/AndroidRuntime( 275): at android.os.Handler.handleCallback(Handler.java:587)
E/AndroidRuntime( 275): at android.os.Handler.dispatchMessage(Handler.java:92)
E/AndroidRuntime( 275): at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime( 275): at android.app.ActivityThread.main(ActivityThread.java:4627)
E/AndroidRuntime( 275): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 275): at java.lang.reflect.Method.invoke(Method.java:521)
E/AndroidRuntime( 275): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
E/AndroidRuntime( 275): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
E/AndroidRuntime( 275): at dalvik.system.NativeStart.main(Native Method)
D/dalvikvm( 58): GC_FOR_MALLOC freed 18388 objects / 947880 bytes in 106ms
W/ActivityManager( 58): Force finishing activity com.accenturelabs.idoc/.RegisterWoman
I/ARMAssembler( 58): generated scanline__00000077:03515104_00000000_00000000 [ 33 ipp] (47 ins) at [0x34d7b0:0x34d86c] in 7148901 ns
Try to chek from your ddms data -> data -> your package ->database
here you will find that table is created of not.
also it you pull it out and open with SQllite browser u will get all the table list in it.
Hope this will help you
You should be extending SQLiteOpenHelper for your database code if you are not already.
Then check that your onUpgrade() method also calls back to your onCreate() method. You may be dropping all your tables and then not re-creating them. Make sure you bump the database version number every time you make a change to your tables.
The google iosched app has a complete, if not slightly complex example of how to do this.
http://code.google.com/p/iosched/source/browse/android/src/com/google/android/apps/iosched/provider/ScheduleDatabase.java
Actually i had to uninstall the application from the emulator .it worked fine after that
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)