I am doing DOM xml parsing,My code is working perfectly on Ginger bread while not working on Jelly Bean. showing NullPointerException . on below line got error.
NodeList n1= doc.getElementsByTagName("dua_detail");
I took xml File from assets folder perfectly on AsyncTask.
08-29 18:01:23.785: E/AndroidRuntime(3575): java.lang.NullPointerException
08-29 18:01:23.785: E/AndroidRuntime(3575): at com.example.zad_e_rah.Finalview.pinpointxml(Finalview.java:67)
08-29 18:01:23.785: E/AndroidRuntime(3575): at com.example.zad_e_rah.Finalview$GetAudiojokefromserver.onPostExecute(Finalview.java:333)
08-29 18:01:23.785: E/AndroidRuntime(3575): at com.example.zad_e_rah.Finalview$GetAudiojokefromserver.onPostExecute(Finalview.java:1)
08-29 18:01:23.785: E/AndroidRuntime(3575): at android.os.AsyncTask.finish(AsyncTask.java:631)
08-29 18:01:23.785: E/AndroidRuntime(3575): at android.os.AsyncTask.access$600(AsyncTask.java:177)
08-29 18:01:23.785: E/AndroidRuntime(3575): at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:644)
08-29 18:01:23.785: E/AndroidRuntime(3575): at android.os.Handler.dispatchMessage(Handler.java:99)
08-29 18:01:23.785: E/AndroidRuntime(3575): at android.os.Looper.loop(Looper.java:153)
08-29 18:01:23.785: E/AndroidRuntime(3575): at android.app.ActivityThread.main(ActivityThread.java:5086)
08-29 18:01:23.785: E/AndroidRuntime(3575): at java.lang.reflect.Method.invokeNative(Native Method)
08-29 18:01:23.785: E/AndroidRuntime(3575): at java.lang.reflect.Method.invoke(Method.java:511)
08-29 18:01:23.785: E/AndroidRuntime(3575): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:821)
If the above line is really the line that throws the exception, the doc-object is probably null. You should check that.
Since you didn't provide more code I cannot tell you why it is null.
Related
I have used ZBAR library to scan bar code in my Application.
And I got this error log while opening camera on Samsung Galaxy S3 :
java.lang.RuntimeException: startPreview failed
at android.hardware.Camera.startPreview(Native Method)
at com.SGID.MainApp.ScanningFragment.engageCamera(ScanningFragment.java:184)
at com.SGID.MainApp.ScanningFragment.access$10(ScanningFragment.java:154)
at com.SGID.MainApp.ScanningFragment$4.run(ScanningFragment.java:111)
at android.os.Handler.handleCallback(Handler.java:615)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4898)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
at dalvik.system.NativeStart.main(Native Method)
java.lang.RuntimeException: Unable to start activity ComponentInfo
{com.SGID.MainApp/com.SGID.MainApp.AllTabsActivity}
: java.lang.NullPointerException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2100)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2125)
at android.app.ActivityThread.access$600(ActivityThread.java:140)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1227)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4898)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at com.SGID.MainApp.ParametersFragment.onCreateView(ParametersFragment.java:78)
at android.support.v4.app.Fragment.performCreateView(Fragment.java:1478)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:927)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1104)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1086)
at android.support.v4.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:1877)
at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:552)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1167)
at android.app.Activity.performStart(Activity.java:5216)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2073)
... 11 more
EDIT :
Getting error at this line :
CameraPreview mPreview = new CameraPreview(getActivity(), mCamera, previewCb,
autoFocusCB);
Can Anyone help me to resolve this error??
Thanks in advance..
I am trying to send an image to server using the HTTP. The external libraries
httpmime-4.0-beta2.jar
commons-io-2.4.jar
apache-mime4j-0.6.jar
have been added.
I am getting the following logcat output as error,what could be the reason?
08-29 15:49:19.422: W/dalvikvm(2723): Unable to resolve superclass of Lorg/apache/http/entity/mime/content/AbstractContentBody; (849)
08-29 15:49:19.462: W/dalvikvm(2723): Link of class 'Lorg/apache/http/entity/mime/content/AbstractContentBody;' failed
08-29 15:49:19.462: W/dalvikvm(2723): Unable to resolve superclass of Lorg/apache/http/entity/mime/content/InputStreamBody; (838)
08-29 15:49:19.462: W/dalvikvm(2723): Link of class 'Lorg/apache/http/entity/mime/content/InputStreamBody;' failed
08-29 15:49:19.462: E/dalvikvm(2723): Could not find class 'org.apache.http.entity.mime.content.InputStreamBody', referenced from method com.example.photoupload.MainActivity.onCreate
08-29 15:49:19.462: W/dalvikvm(2723): VFY: unable to resolve new-instance 841 (Lorg/apache/http/entity/mime/content/InputStreamBody;) in Lcom/example/photoupload/MainActivity;
08-29 15:49:19.462: D/dalvikvm(2723): VFY: replacing opcode 0x22 at 0x0043
08-29 15:49:19.832: D/dalvikvm(2723): GC_FOR_ALLOC freed 52K, 3% free 8964K/9223K, paused 81ms
08-29 15:49:19.882: D/dalvikvm(2723): GC_FOR_ALLOC freed 4K, 4% free 9216K/9543K, paused 40ms
08-29 15:49:19.892: D/AndroidRuntime(2723): Shutting down VM
08-29 15:49:19.892: W/dalvikvm(2723): threadid=1: thread exiting with uncaught exception (group=0x40014760)
08-29 15:49:19.892: E/AndroidRuntime(2723): FATAL EXCEPTION: main
08-29 15:49:19.892: E/AndroidRuntime(2723): java.lang.NoClassDefFoundError: org.apache.http.entity.mime.content.InputStreamBody
08-29 15:49:19.892: E/AndroidRuntime(2723): at com.example.photoupload.MainActivity.onCreate(MainActivity.java:39)
08-29 15:49:19.892: E/AndroidRuntime(2723): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1048)
08-29 15:49:19.892: E/AndroidRuntime(2723): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1712)
08-29 15:49:19.892: E/AndroidRuntime(2723): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1764)
08-29 15:49:19.892: E/AndroidRuntime(2723): at android.app.ActivityThread.access$1500(ActivityThread.java:122)
08-29 15:49:19.892: E/AndroidRuntime(2723): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1002)
08-29 15:49:19.892: E/AndroidRuntime(2723): at android.os.Handler.dispatchMessage(Handler.java:99)
08-29 15:49:19.892: E/AndroidRuntime(2723): at android.os.Looper.loop(Looper.java:132)
08-29 15:49:19.892: E/AndroidRuntime(2723): at android.app.ActivityThread.main(ActivityThread.java:4025)
08-29 15:49:19.892: E/AndroidRuntime(2723): at java.lang.reflect.Method.invokeNative(Native Method)
08-29 15:49:19.892: E/AndroidRuntime(2723): at java.lang.reflect.Method.invoke(Method.java:491)
08-29 15:49:19.892: E/AndroidRuntime(2723): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
08-29 15:49:19.892: E/AndroidRuntime(2723): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
08-29 15:49:19.892: E/AndroidRuntime(2723): at dalvik.system.NativeStart.main(Native Method)
08-29 15:49:21.842: I/Process(2723): Sending signal. PID: 2723 SIG: 9
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
08-02 20:48:36.703: D/EditText(3575): nouy
08-02 20:48:36.793: I/Choreographer(3575): Skipped 68 frames! The application may be doing too much work on its main thread.
08-02 20:48:37.143: D/dalvikvm(3575): GC_CONCURRENT freed 1331K, 34% free 2956K/4428K, paused 4ms+59ms, total 137ms
08-02 20:48:37.353: D/AndroidRuntime(3575): Shutting down VM
08-02 20:48:37.394: W/dalvikvm(3575): threadid=1: thread exiting with uncaught exception (group=0x40a71930)
08-02 20:48:37.443: E/AndroidRuntime(3575): FATAL EXCEPTION: main
08-02 20:48:37.443: E/AndroidRuntime(3575): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.note/com.example.note.NoteEdit}: android.database.CursorIndexOutOfBoundsException: Index 0 requested, with a size of 0
08-02 20:48:37.443: E/AndroidRuntime(3575): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
08-02 20:48:37.443: E/AndroidRuntime(3575): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
08-02 20:48:37.443: E/AndroidRuntime(3575): at android.app.ActivityThread.access$600(ActivityThread.java:141)
08-02 20:48:37.443: E/AndroidRuntime(3575): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
08-02 20:48:37.443: E/AndroidRuntime(3575): at android.os.Handler.dispatchMessage(Handler.java:99)
08-02 20:48:37.443: E/AndroidRuntime(3575): at android.os.Looper.loop(Looper.java:137)
08-02 20:48:37.443: E/AndroidRuntime(3575): at android.app.ActivityThread.main(ActivityThread.java:5041)
08-02 20:48:37.443: E/AndroidRuntime(3575): at java.lang.reflect.Method.invokeNative(Native Method)
08-02 20:48:37.443: E/AndroidRuntime(3575): at java.lang.reflect.Method.invoke(Method.java:511)
08-02 20:48:37.443: E/AndroidRuntime(3575): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
08-02 20:48:37.443: E/AndroidRuntime(3575): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
08-02 20:48:37.443: E/AndroidRuntime(3575): at dalvik.system.NativeStart.main(Native Method)
08-02 20:48:37.443: E/AndroidRuntime(3575): Caused by: android.database.CursorIndexOutOfBoundsException: Index 0 requested, with a size of 0
08-02 20:48:37.443: E/AndroidRuntime(3575): at android.database.AbstractCursor.checkPosition(AbstractCursor.java:424)
08-02 20:48:37.443: E/AndroidRuntime(3575): at android.database.AbstractWindowedCursor.checkPosition(AbstractWindowedCursor.java:136)
08-02 20:48:37.443: E/AndroidRuntime(3575): at android.database.AbstractWindowedCursor.getString(AbstractWindowedCursor.java:50)
08-02 20:48:37.443: E/AndroidRuntime(3575): at com.example.note.NoteEdit.populateFields(NoteEdit.java:231)
08-02 20:48:37.443: E/AndroidRuntime(3575): at com.example.note.NoteEdit.onCreate(NoteEdit.java:99)
08-02 20:48:37.443: E/AndroidRuntime(3575): at android.app.Activity.performCreate(Activity.java:5104)
08-02 20:48:37.443: E/AndroidRuntime(3575): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
08-02 20:48:37.443: E/AndroidRuntime(3575): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
The output in Logcat should be read from top(in your case, FATAL EXCEPTION: main onwards). However, you need to find how your activity contributes to the error. In most cases(and definitely not all), you will find Logcat informing you about a line of code inside the scope of your app. This is where the exception originated:
08-02 20:48:37.443: E/AndroidRuntime(3575): Caused by: android.database.CursorIndexOutOfBoundsException: Index 0 requested, with a size of 0
08-02 20:48:37.443: E/AndroidRuntime(3575): at android.database.AbstractCursor.checkPosition(AbstractCursor.java:424)
08-02 20:48:37.443: E/AndroidRuntime(3575): at android.database.AbstractWindowedCursor.checkPosition(AbstractWindowedCursor.java:136)
08-02 20:48:37.443: E/AndroidRuntime(3575): at android.database.AbstractWindowedCursor.getString(AbstractWindowedCursor.java:50)
-------->>>>>>>>> 08-02 20:48:37.443: E/AndroidRuntime(3575): at com.example.note.NoteEdit.populateFields(NoteEdit.java:231)
After this, the error propagates towards the top before reaching:
08-02 20:48:37.443: E/AndroidRuntime(3575): FATAL EXCEPTION: main
08-02 20:48:37.443: E/AndroidRuntime(3575): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.note/com.example.note.NoteEdit}: android.database.CursorIndexOutOfBoundsException: Index 0 requested, with a size of 0
Another thing to be careful about: exceptions don't always occur independently. You can have several exceptions stacked up. In this case, find the exception that is thrown first(lowest in the Logcat output) and work your way to the top.
I can't find following error in my code. It looks like the problem is in the asynctask onpostexecute.
java.lang.IllegalArgumentException: View not attached to window manager
at android.view.WindowManagerImpl.findViewLocked(WindowManagerImpl.java:672)
at android.view.WindowManagerImpl.removeView(WindowManagerImpl.java:368)
at android.view.WindowManagerImpl$CompatModeWrapper.removeView(WindowManagerImpl.java:160)
at android.app.Dialog.dismissDialog(Dialog.java:319)
at android.app.Dialog.dismiss(Dialog.java:302)
at www.mobilezar.mn.Advertisements$InitialLoading.onPostExecute(Advertisements.java:216)
at www.mobilezar.mn.Advertisements$InitialLoading.onPostExecute(Advertisements.java:1)
at android.os.AsyncTask.finish(AsyncTask.java:631)
at android.os.AsyncTask.access$600(AsyncTask.java:177)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:644)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4898)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
at dalvik.system.NativeStart.main(Native Method)
I am using Eclipse to write the program. I have gotten rid of the errors, and have completely compiled the code and when it launches in the emulator, it forces close. I have zipped the workspace so maybe someone can grab it and load it to see if they are able to see why its bombing out? deckertdesigns.com/Android/Todo_List.zip any help again, would be greatly appreciated. I feel once over this hump I will have some better knowledge in troubleshooting, just wish the debugger was catching this...
08-29 17:43:45.273: DEBUG/SntpClient(73): request time failed: java.net.SocketException:
Address family not supported by protocol
08-29 17:44:41.433: DEBUG/AndroidRuntime(357): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
08-29 17:44:41.433: DEBUG/AndroidRuntime(357): CheckJNI is ON
08-29 17:44:41.852: DEBUG/AndroidRuntime(357): --- registering native functions ---
08-29 17:44:43.293: DEBUG/AndroidRuntime(357): Shutting down VM
08-29 17:44:43.313: INFO/AndroidRuntime(357): NOTE: attach of thread 'Binder Thread #3' failed
08-29 17:44:43.323: DEBUG/dalvikvm(357): Debugger has detached; object registry had 1 entries
08-29 17:44:44.083: DEBUG/AndroidRuntime(365): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
08-29 17:44:44.083: DEBUG/AndroidRuntime(365): CheckJNI is ON
08-29 17:44:44.403: DEBUG/AndroidRuntime(365): --- registering native functions ---
08-29 17:44:45.573: INFO/ActivityManager(73): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.a8a.todolist/.ToDoList }
08-29 17:44:45.683: DEBUG/AndroidRuntime(365): Shutting down VM
08-29 17:44:45.713: DEBUG/dalvikvm(365): Debugger has detached; object registry had 1 entries
08-29 17:44:45.773: INFO/AndroidRuntime(365): NOTE: attach of thread 'Binder Thread #3' failed
08-29 17:44:45.843: INFO/ActivityManager(73): Start proc com.a8a.todolist for activity com.a8a.todolist/.ToDoList: pid=372 uid=10032 gids={1015}
08-29 17:44:47.013: DEBUG/AndroidRuntime(372): Shutting down VM
08-29 17:44:47.013: WARN/dalvikvm(372): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
08-29 17:44:47.043: ERROR/AndroidRuntime(372): FATAL EXCEPTION: main
08-29 17:44:47.043: ERROR/AndroidRuntime(372): android.app.SuperNotCalledException: Activity {com.a8a.todolist/com.a8a.todolist.ToDoList} did not call through to super.onCreate()
08-29 17:44:47.043: ERROR/AndroidRuntime(372): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2629)
08-29 17:44:47.043: ERROR/AndroidRuntime(372): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
08-29 17:44:47.043: ERROR/AndroidRuntime(372): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
08-29 17:44:47.043: ERROR/AndroidRuntime(372): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
08-29 17:44:47.043: ERROR/AndroidRuntime(372): at android.os.Handler.dispatchMessage(Handler.java:99)
08-29 17:44:47.043: ERROR/AndroidRuntime(372): at android.os.Looper.loop(Looper.java:123)
08-29 17:44:47.043: ERROR/AndroidRuntime(372): at android.app.ActivityThread.main(ActivityThread.java:4627)
08-29 17:44:47.043: ERROR/AndroidRuntime(372): at java.lang.reflect.Method.invokeNative(Native Method)
08-29 17:44:47.043: ERROR/AndroidRuntime(372): at java.lang.reflect.Method.invoke(Method.java:521)
08-29 17:44:47.043: ERROR/AndroidRuntime(372): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
08-29 17:44:47.043: ERROR/AndroidRuntime(372): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
08-29 17:44:47.043: ERROR/AndroidRuntime(372): at dalvik.system.NativeStart.main(Native Method)
08-29 17:44:47.063: WARN/ActivityManager(73): Force finishing activity com.a8a.todolist/.ToDoList
08-29 17:44:47.243: DEBUG/dalvikvm(73): GC_FOR_MALLOC freed 7176 objects / 434168 bytes in 169ms
08-29 17:44:47.633: WARN/ActivityManager(73): Activity pause timeout for HistoryRecord{43fc9668 com.a8a.todolist/.ToDoList}
08-29 17:44:53.253: INFO/Process(372): Sending signal. PID: 372 SIG: 9
08-29 17:44:53.285: INFO/ActivityManager(73): Process com.a8a.todolist (pid 372) has died.
08-29 17:44:53.323: WARN/InputManagerService(73): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy#440687c8
08-29 17:44:58.383: WARN/ActivityManager(73): Activity destroy timeout for HistoryRecord{43fc9668 com.a8a.todolist/.ToDoList}
Rohan is right, inside Eclipse you open the DDMS perspective, you'll see a tab called "Logcat" which contains all the printed logs and includes also a detailed stacktrace of the exception which caused the Force Close popup to appear.
You miss probably the the "super.onCreate(savedInstanceState)" in your onCreate method.
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(...);
...
}
Check out the logcat to see the error...it would be displayed against your package name in red color....This is the only method to check the Force Close type of errors....