title: Android - My arraylist is crashing my app
body: <p>I built a method that returns a specific value, and this value is taken from a arraylist.</p>
  
  <p>This value is being printed on my listview, so I'm calling the method on my listview adapter.</p>
  
  <p>But sometimes (not always), my app crashes, because something happens with the arraylist.</p>
  
  <p>Its really weird because this issue only happens sometimes.</p>
  
  <p>Could you guys please tell what do I need to change on my code to run properly? </p>
  
  <p>Errors:</p>
  
  <blockquote>
    <p>java.util.ConcurrentModificationException
                                                                                   at java.util.ArrayList$ArrayListIterator.next(ArrayList.java:573)  at com.example.*****.getCountry(MySQLReceiver.java:124)</p>
  </blockquote>
  
  <p>My code</p>
  
  <pre><code>public int getCountry(int receiveUserId){
  
      for (Users user : getAllUsers()) {
  
          if (receiveUserId == user.getUserId()) {
  
              userCountry = user.getUserCountry();
  
          }
  
      }
  
      return userCountry;
  
  }
  </code></pre>
  
  <p>Thank you.</p>