java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object android.widget.ListView.getItemAtPosition(int)' on a null object reference

Stack Overflow | trocchietto | 4 months ago
  1. 0

    Getting NPE, cannot retrieve ListView content at clicked position in Navigation Drawer

    Stack Overflow | 4 months ago | trocchietto
    java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object android.widget.ListView.getItemAtPosition(int)' on a null object reference
  2. 0

    App crashes with NPE from fragment manager makeInactive method

    Stack Overflow | 3 weeks ago | Ruturaj Patil
    java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object java.util.ArrayList.set(int, java.lang.Object)' on a null object reference
  3. 0

    Attempting to close a Ti.UI.TabGroup when it contains a ti.map map view in one of it's tabs causes the app crash. Test case: {code} // this sets the background color of the master UIView (when there are no windows/tab groups on it) Titanium.UI.setBackgroundColor('#000'); // create tab group var tabGroup = Titanium.UI.createTabGroup(); var win1 = Titanium.UI.createWindow({ title:'Tab 1', backgroundColor:'#fff' }); var tab1 = Titanium.UI.createTab({ icon:'KS_nav_views.png', title:'Tab 1', window:win1 }); var Map = require('ti.map'); var mapview = Map.createView(); win1.add(mapview); tabGroup.addTab(tab1); tabGroup.open(); // Close the tabGroup after 8 seconds setTimeout(function(){ console.log("Closing tabGroup"); tabGroup.close(); }, 8000); {code} Stack trace: {panel} [ERROR] TiApplication: (main) [8315,8315] Sending event: exception on thread: main msg:java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object java.util.ArrayList.set(int, java.lang.Object)' on a null object reference; Titanium 5.1.2,2015/12/16 19:00,ca822b2 [ERROR] TiApplication: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object java.util.ArrayList.set(int, java.lang.Object)' on a null object reference [ERROR] TiApplication: at android.support.v4.app.FragmentManagerImpl.makeInactive(FragmentManager.java:1261) [ERROR] TiApplication: at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1168) [ERROR] TiApplication: at android.support.v4.app.FragmentManagerImpl.removeFragment(FragmentManager.java:1304) [ERROR] TiApplication: at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:708) [ERROR] TiApplication: at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1572) [ERROR] TiApplication: at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:493) [ERROR] TiApplication: at android.os.Handler.handleCallback(Handler.java:739) [ERROR] TiApplication: at android.os.Handler.dispatchMessage(Handler.java:95) [ERROR] TiApplication: at android.os.Looper.loop(Looper.java:145) [ERROR] TiApplication: at android.app.ActivityThread.main(ActivityThread.java:5832) [ERROR] TiApplication: at java.lang.reflect.Method.invoke(Native Method) [ERROR] TiApplication: at java.lang.reflect.Method.invoke(Method.java:372) [ERROR] TiApplication: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399) [ERROR] TiApplication: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194) [ERROR] AndroidRuntime: FATAL EXCEPTION: main [ERROR] AndroidRuntime: Process: com.thevirtualforge.tabtest2, PID: 6616 [ERROR] AndroidRuntime: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object java.util.ArrayList.set(int, java.lang.Object)' on a null object reference [ERROR] AndroidRuntime: at android.support.v4.app.FragmentManagerImpl.makeInactive(FragmentManager.java:1261) [ERROR] AndroidRuntime: at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1168) [ERROR] AndroidRuntime: at android.support.v4.app.FragmentManagerImpl.removeFragment(FragmentManager.java:1304) [ERROR] AndroidRuntime: at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:708) [ERROR] AndroidRuntime: at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1572) [ERROR] AndroidRuntime: at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:493) [ERROR] AndroidRuntime: at android.os.Handler.handleCallback(Handler.java:739) [ERROR] AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:95) [ERROR] AndroidRuntime: at android.os.Looper.loop(Looper.java:145) [ERROR] AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:5832) [ERROR] AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method) [ERROR] AndroidRuntime: at java.lang.reflect.Method.invoke(Method.java:372) [ERROR] AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399) [ERROR] AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194) {panel}

    Appcelerator JIRA | 10 months ago | Terry Morgan
    java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object java.util.ArrayList.set(int, java.lang.Object)' on a null object reference
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Null Pointer Exception When Writing to ArrayList

    Stack Overflow | 1 year ago | António Paulo
    java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object java.util.ArrayList.set(int, java.lang.Object)' on a null object reference
  6. 0

    Attempting to close a Ti.UI.TabGroup when it contains a ti.map map view in one of it's tabs causes the app crash. Test case: {code} // this sets the background color of the master UIView (when there are no windows/tab groups on it) Titanium.UI.setBackgroundColor('#000'); // create tab group var tabGroup = Titanium.UI.createTabGroup(); var win1 = Titanium.UI.createWindow({ title:'Tab 1', backgroundColor:'#fff' }); var tab1 = Titanium.UI.createTab({ icon:'KS_nav_views.png', title:'Tab 1', window:win1 }); var Map = require('ti.map'); var mapview = Map.createView(); win1.add(mapview); tabGroup.addTab(tab1); tabGroup.open(); // Close the tabGroup after 8 seconds setTimeout(function(){ console.log("Closing tabGroup"); tabGroup.close(); }, 8000); {code} Stack trace: {panel} [ERROR] TiApplication: (main) [8315,8315] Sending event: exception on thread: main msg:java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object java.util.ArrayList.set(int, java.lang.Object)' on a null object reference; Titanium 5.1.2,2015/12/16 19:00,ca822b2 [ERROR] TiApplication: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object java.util.ArrayList.set(int, java.lang.Object)' on a null object reference [ERROR] TiApplication: at android.support.v4.app.FragmentManagerImpl.makeInactive(FragmentManager.java:1261) [ERROR] TiApplication: at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1168) [ERROR] TiApplication: at android.support.v4.app.FragmentManagerImpl.removeFragment(FragmentManager.java:1304) [ERROR] TiApplication: at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:708) [ERROR] TiApplication: at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1572) [ERROR] TiApplication: at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:493) [ERROR] TiApplication: at android.os.Handler.handleCallback(Handler.java:739) [ERROR] TiApplication: at android.os.Handler.dispatchMessage(Handler.java:95) [ERROR] TiApplication: at android.os.Looper.loop(Looper.java:145) [ERROR] TiApplication: at android.app.ActivityThread.main(ActivityThread.java:5832) [ERROR] TiApplication: at java.lang.reflect.Method.invoke(Native Method) [ERROR] TiApplication: at java.lang.reflect.Method.invoke(Method.java:372) [ERROR] TiApplication: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399) [ERROR] TiApplication: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194) [ERROR] AndroidRuntime: FATAL EXCEPTION: main [ERROR] AndroidRuntime: Process: com.thevirtualforge.tabtest2, PID: 6616 [ERROR] AndroidRuntime: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object java.util.ArrayList.set(int, java.lang.Object)' on a null object reference [ERROR] AndroidRuntime: at android.support.v4.app.FragmentManagerImpl.makeInactive(FragmentManager.java:1261) [ERROR] AndroidRuntime: at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1168) [ERROR] AndroidRuntime: at android.support.v4.app.FragmentManagerImpl.removeFragment(FragmentManager.java:1304) [ERROR] AndroidRuntime: at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:708) [ERROR] AndroidRuntime: at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1572) [ERROR] AndroidRuntime: at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:493) [ERROR] AndroidRuntime: at android.os.Handler.handleCallback(Handler.java:739) [ERROR] AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:95) [ERROR] AndroidRuntime: at android.os.Looper.loop(Looper.java:145) [ERROR] AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:5832) [ERROR] AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method) [ERROR] AndroidRuntime: at java.lang.reflect.Method.invoke(Method.java:372) [ERROR] AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399) [ERROR] AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194) {panel}

    Appcelerator JIRA | 10 months ago | Terry Morgan
    java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object java.util.ArrayList.set(int, java.lang.Object)' on a null object reference

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.NullPointerException

      Attempt to invoke virtual method 'java.lang.Object android.widget.ListView.getItemAtPosition(int)' on a null object reference

      at android.com.myapp.DrawerItemClickListener.onItemClick()
    2. android.com.myapp
      DrawerItemClickListener.onItemClick
      1. android.com.myapp.DrawerItemClickListener.onItemClick(DrawerItemClickListener.java:22)
      1 frame