Android examples for android.widget:Adapter
get Adapter Position By Id
import android.widget.Adapter; import java.util.NoSuchElementException; public class Main{ public static final int getAdapterPositionById(final Adapter adapter, final long id) throws NoSuchElementException { final int count = adapter.getCount(); for (int pos = 0; pos < count; pos++) { if (id == adapter.getItemId(pos)) { return pos; }//w w w. j ava 2 s . co m } throw new NoSuchElementException(); } }