java.lang.NullPointerException: Attempt to invoke virtual method 'java.util.Iterator java.util.ArrayList.iterator()' on a null object reference

tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    Maintain reference to fragment on rotation

    Stack Overflow | 5 months ago | Ephraim Schmitt
    java.lang.NullPointerException: Attempt to invoke virtual method 'java.util.Iterator java.util.ArrayList.iterator()' on a null object reference

    Root Cause Analysis

    1. java.lang.NullPointerException

      Attempt to invoke virtual method 'java.util.Iterator java.util.ArrayList.iterator()' on a null object reference

      at com.clashtoolkit.clashtoolkit.calculator.fragments.CalculatorItemListFragment.clearArmy()
    2. com.clashtoolkit.clashtoolkit
      CalculatorMainActivity.onOptionsItemSelected
      1. com.clashtoolkit.clashtoolkit.calculator.fragments.CalculatorItemListFragment.clearArmy(CalculatorItemListFragment.java:228)
      2. com.clashtoolkit.clashtoolkit.calculator.activities.CalculatorMainActivity.clearArmy(CalculatorMainActivity.java:152)
      3. com.clashtoolkit.clashtoolkit.calculator.activities.CalculatorMainActivity.onOptionsItemSelected(CalculatorMainActivity.java:123)
      3 frames
    3. Android Platform
      Activity.onMenuItemSelected
      1. android.app.Activity.onMenuItemSelected(Activity.java:3204)
      1 frame
    4. Android Support v4
      FragmentActivity.onMenuItemSelected
      1. android.support.v4.app.FragmentActivity.onMenuItemSelected(FragmentActivity.java:421)
      1 frame
    5. Android v7
      ActionMenuView$MenuBuilderCallback.onMenuItemSelected
      1. android.support.v7.app.AppCompatActivity.onMenuItemSelected(AppCompatActivity.java:189)
      2. android.support.v7.view.WindowCallbackWrapper.onMenuItemSelected(WindowCallbackWrapper.java:100)
      3. android.support.v7.view.WindowCallbackWrapper.onMenuItemSelected(WindowCallbackWrapper.java:100)
      4. android.support.v7.app.ToolbarActionBar$2.onMenuItemClick(ToolbarActionBar.java:69)
      5. android.support.v7.widget.Toolbar$1.onMenuItemClick(Toolbar.java:169)
      6. android.support.v7.widget.ActionMenuView$MenuBuilderCallback.onMenuItemSelected(ActionMenuView.java:760)
      6 frames
    6. android.support.v7
      MenuBuilder.performItemAction
      1. android.support.v7.view.menu.MenuBuilder.dispatchMenuItemSelected(MenuBuilder.java:811)
      2. android.support.v7.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:152)
      3. android.support.v7.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:958)
      4. android.support.v7.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:948)
      4 frames
    7. Android v7
      ActionMenuView.invokeItem
      1. android.support.v7.widget.ActionMenuView.invokeItem(ActionMenuView.java:618)
      1 frame
    8. android.support.v7
      ActionMenuItemView.onClick
      1. android.support.v7.view.menu.ActionMenuItemView.onClick(ActionMenuItemView.java:139)
      1 frame
    9. Android Platform
      ActivityThread.main
      1. android.view.View.performClick(View.java:5702)
      2. android.widget.TextView.performClick(TextView.java:10887)
      3. android.view.View$PerformClick.run(View.java:22533)
      4. android.os.Handler.handleCallback(Handler.java:739)
      5. android.os.Handler.dispatchMessage(Handler.java:95)
      6. android.os.Looper.loop(Looper.java:158)
      7. android.app.ActivityThread.main(ActivityThread.java:7224)
      7 frames
    10. Java RT
      Method.invoke
      1. java.lang.reflect.Method.invoke(Native Method)
      1 frame
    11. Android
      ZygoteInit.main
      1. com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
      2. com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
      2 frames