Why VideoView force closes on Micromax Canvas magnus ?
java.lang.StringIndexOutOfBoundsException: length=11; regionStart=0;
regionLength=-1 at java.lang.String.startEndAndLength(String.java:583)
at java.lang.String.substring(String.java:1464) at
android.widget.VideoView.openVideo(VideoView.java:407) at
android.widget.VideoView$6.surfaceCreated(VideoView.java:730) at
android.view.SurfaceView.updateWindow(SurfaceView.java:606) at
android.view.SurfaceView.access$000(SurfaceView.java:88) at
android.view.SurfaceView$3.onPreDraw(SurfaceView.java:183) at
android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:692)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2123)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1139) at
android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4879)
at
android.view.Choreographer$CallbackRecord.run(Choreographer.java:776)
at android.view.Choreographer.doCallbacks(Choreographer.java:579) at
android.view.Choreographer.doFrame(Choreographer.java:548) at
android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:762)
at android.os.Handler.handleCallback(Handler.java:725) at
android.os.Handler.dispatchMessage(Handler.java:92) at
android.os.Looper.loop(Looper.java:153) at
android.app.ActivityThread.main(ActivityThread.java:5297) 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:833)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600) at
dalvik.system.NativeStart.main(Native Method)
Related
This question already has answers here:
What is a NullPointerException, and how do I fix it?
(12 answers)
Closed 5 years ago.
01-02 05:30:50.220 8776-8776/com.wordpress.alhazn.puhaba E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.wordpress.alhazn.puhaba/com.wordpress.alhazn.puhaba.MainActivity}: java.lang.NullPointerException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2045)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2146)
at android.app.ActivityThread.access$700(ActivityThread.java:140)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1238)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:177)
at android.app.ActivityThread.main(ActivityThread.java:4944)
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:1038)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at android.support.v7.app.AppCompatDelegateImplBase.<init>(AppCompatDelegateImplBase.java:117)
at android.support.v7.app.AppCompatDelegateImplV9.<init>(AppCompatDelegateImplV9.java:149)
at android.support.v7.app.AppCompatDelegateImplV11.<init>(AppCompatDelegateImplV11.java:29)
at android.support.v7.app.AppCompatDelegateImplV14.<init>(AppCompatDelegateImplV14.java:54)
at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:202)
at android.support.v7.app.AppCompatDelegate.create(AppCompatDelegate.java:183)
at android.support.v7.app.AppCompatActivity.getDelegate(AppCompatActivity.java:519)
at android.support.v7.app.AppCompatActivity.findViewById(AppCompatActivity.java:190)
at com.wordpress.alhazn.puhaba.MainActivity.<init>(MainActivity.java:44)
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1319)
at android.app.Instrumentation.newActivity(Instrumentation.java:1068)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2036)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2146)
at android.app.ActivityThread.access$700(ActivityThread.java:140)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1238)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:177)
at android.app.ActivityThread.main(ActivityThread.java:4944)
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:1038)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
at dalvik.system.NativeStart.main(Native Method)
Move your findViewById() calls later in the activity lifecycle. Not in <init> i.e. constructor/field initialization but rather e.g. onCreate() after you've also called setContentView().
I get Null Pointer Exception at open ListActivity in my code but all trace is not my code.
java.lang.NullPointerException at
android.widget.AbsListView.obtainView(AbsListView.java:2606) at
android.widget.ListView.makeAndAddView(ListView.java:1840) at
android.widget.ListView.fillDown(ListView.java:681) at
android.widget.ListView.fillFromTop(ListView.java:742) at
android.widget.ListView.layoutChildren(ListView.java:1661) at
android.widget.AbsListView.onLayout(AbsListView.java:2427) at
android.view.View.layout(View.java:14938) at
android.view.ViewGroup.layout(ViewGroup.java:4601) at
android.widget.RelativeLayout.onLayout(RelativeLayout.java:1021) at
android.view.View.layout(View.java:14938) at
android.view.ViewGroup.layout(ViewGroup.java:4601) at
android.widget.FrameLayout.onLayout(FrameLayout.java:448) at
android.view.View.layout(View.java:14938) at
android.view.ViewGroup.layout(ViewGroup.java:4601) at
android.widget.FrameLayout.onLayout(FrameLayout.java:448) at
android.view.View.layout(View.java:14938) at
android.view.ViewGroup.layout(ViewGroup.java:4601) at
android.widget.LinearLayout.setChildFrame(LinearLayout.java:1694) at
android.widget.LinearLayout.layoutVertical(LinearLayout.java:1552) at
android.widget.LinearLayout.onLayout(LinearLayout.java:1465) at
android.view.View.layout(View.java:14938) at
android.view.ViewGroup.layout(ViewGroup.java:4601) at
android.widget.FrameLayout.onLayout(FrameLayout.java:448) at
android.view.View.layout(View.java:14938) at
android.view.ViewGroup.layout(ViewGroup.java:4601) at
android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2212) at
android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2026)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1236) at
android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5160)
at
android.view.Choreographer$CallbackRecord.run(Choreographer.java:791)
at android.view.Choreographer.doCallbacks(Choreographer.java:591) at
android.view.Choreographer.doFrame(Choreographer.java:561) at
android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:777)
at android.os.Handler.handleCallback(Handler.java:725) at
android.os.Handler.dispatchMessage(Handler.java:92) at
android.os.Looper.loop(Looper.java:176) at
android.app.ActivityThread.main(ActivityThread.java:5365) 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:1102)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869) at
dalvik.system.NativeStart.main(Native Method)
How I can know where the error occurs?
As #iagreen said, "Specifically, you are returning null from your getView method of your Adapter".
I was returning null in some case in custom adapter in getWiew.
I am building an application in which I am inserting events directly to the calendar plus I left the possibility to invite someone else and everything is perfectly fine if I execute it on android sdk version 19 and above, on lower versions I get an exception.
Here is the source:
ContentResolver atend = getContentResolver();
ContentValues val = new ContentValues();
val.put(CalendarContract.Attendees.ATTENDEE_NAME, "Bajo");
val.put(CalendarContract.Attendees.ATTENDEE_EMAIL, someonesEmail);
val.put(CalendarContract.Attendees.ATTENDEE_RELATIONSHIP, CalendarContract.Attendees.RELATIONSHIP_ATTENDEE);
val.put(CalendarContract.Attendees.ATTENDEE_TYPE, CalendarContract.Attendees.TYPE_REQUIRED);
val.put(CalendarContract.Attendees.ATTENDEE_STATUS, CalendarContract.Attendees.ATTENDEE_STATUS_INVITED);
val.put(CalendarContract.Attendees.EVENT_ID, eventID);
Uri muri= atend.insert(CalendarContract.Attendees.CONTENT_URI, val);
Log.d("Atendees URI:",muri.toString());
long Aeventid=Long.parseLong(muri.getLastPathSegment());
the Exception:
03-05 19:45:59.681 1255-1266/? E/DatabaseUtils﹕ Writing exception to parcel
android.database.sqlite.SQLiteDoneException
at android.database.sqlite.SQLiteConnection.nativeExecuteForLong(Native Method)
at android.database.sqlite.SQLiteConnection.executeForLong(SQLiteConnection.java:591)
at android.database.sqlite.SQLiteSession.executeForLong(SQLiteSession.java:652)
at android.database.sqlite.SQLiteStatement.simpleQueryForLong(SQLiteStatement.java:107)
at android.database.DatabaseUtils.longForQuery(DatabaseUtils.java:816)
at android.database.DatabaseUtils.longForQuery(DatabaseUtils.java:804)
at com.android.providers.calendar.CalendarDatabaseHelper.duplicateEvent(CalendarDatabaseHelper.java:3311)
at com.android.providers.calendar.CalendarProvider2.insertInTransaction(CalendarProvider2.java:2265)
at com.android.providers.calendar.SQLiteContentProvider.insert(SQLiteContentProvider.java:96)
at android.content.ContentProvider$Transport.insert(ContentProvider.java:201)
at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:148)
at android.os.Binder.execTransact(Binder.java:367)
at dalvik.system.NativeStart.run(Native Method)
03-05 19:45:59.681 1632-1632/? D/AndroidRuntime﹕ Shutting down VM
03-05 19:45:59.681 1632-1632/? W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0xb2f7e288)
03-05 19:45:59.681 1632-1632/? E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.IllegalStateException: Could not execute method of the activity
at android.view.View$1.onClick(View.java:3591)
at android.view.View.performClick(View.java:4084)
at android.view.View$PerformClick.run(View.java:16966)
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:4745)
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:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at android.view.View$1.onClick(View.java:3586)
at android.view.View.performClick(View.java:4084)
at android.view.View$PerformClick.run(View.java:16966)
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:4745)
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:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.database.sqlite.SQLiteException
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:184)
at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:140)
at android.content.ContentProviderProxy.insert(ContentProviderNative.java:420)
at android.content.ContentResolver.insert(ContentResolver.java:864)
at com.example.rusev.vetcalendar.MainActivity.insertToCalendarImmunization(MainActivity.java:809)
at com.example.rusev.vetcalendar.MainActivity.syncToCalendar(MainActivity.java:931)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at android.view.View$1.onClick(View.java:3586)
at android.view.View.performClick(View.java:4084)
at android.view.View$PerformClick.run(View.java:16966)
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:4745)
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:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
Can you help me to identify what I miss?
I have this exception:
java.lang.NullPointerException
at android.webkit.WebViewClassic.requestFocus(WebViewClassic.java:10003)
at android.webkit.WebView.requestFocus(WebView.java:2133)
at android.view.ViewGroup.onRequestFocusInDescendants(ViewGroup.java:2382)
at android.view.ViewGroup.requestFocus(ViewGroup.java:2338)
at android.view.ViewGroup.onRequestFocusInDescendants(ViewGroup.java:2382)
at android.view.ViewGroup.requestFocus(ViewGroup.java:2338)
at android.view.ViewGroup.onRequestFocusInDescendants(ViewGroup.java:2382)
at android.view.ViewGroup.requestFocus(ViewGroup.java:2341)
at android.view.View.requestFocus(View.java:6538)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1899)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1110)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4472)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:725)
at android.view.Choreographer.doCallbacks(Choreographer.java:555)
at android.view.Choreographer.doFrame(Choreographer.java:525)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:711)
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:4918)
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:1004)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:771)
at dalvik.system.NativeStart.main(Native Method)
But it doesn't tell me what line it happened on or anything else. Any idea how to debug this?
Thanks,
Alex
When my app loads the following error comes up on some devices. It refers to none of my source files at all! How do I go about fixing this one?
java.lang.NullPointerException
at com.google.android.maps.OverlayBundle.draw(OverlayBundle.java:42)
at com.google.android.maps.MapView.onDraw(MapView.java:494)
at android.view.View.draw(View.java:6739)
at android.view.ViewGroup.drawChild(ViewGroup.java:1648)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1375)
at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1375)
at android.view.View.draw(View.java:6742)
at android.widget.FrameLayout.draw(FrameLayout.java:352)
at android.view.ViewGroup.drawChild(ViewGroup.java:1648)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1375)
at android.view.View.draw(View.java:6742)
at android.widget.FrameLayout.draw(FrameLayout.java:352)
at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1872)
at android.view.ViewRoot.draw(ViewRoot.java:1422)
at android.view.ViewRoot.performTraversals(ViewRoot.java:1167)
at android.view.ViewRoot.handleMessage(ViewRoot.java:1744)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:144)
at android.app.ActivityThread.main(ActivityThread.java:4937)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
at dalvik.system.NativeStart.main(Native Method)
As mentioned here: Marking Current Location on Map, Android and here http://code.google.com/p/android/issues/detail?id=2035, you may need to call overlays.populate(); method in your code.