title: Select next and previous element from ArrayList selected value
body: <p>In my android application i want to get all previous and after elements from <code>ArrayList</code> selected value. I am using following code for this but its not working.
  </p>
  
  <pre><code>ListIterator&lt;Integer&gt; iterator = photoall_id.listIterator();
  while(iterator.hasNext())
  {
      new  GetImage().execute(url);
      System.out.println(iterator.next());
      System.out.println(iterator.previous());
  }
  </code></pre>
  
  <p>this give <code>random</code> values repeatedly. I want to get data from selected position of <code>ArrayList</code>.</p>