Android examples for Database:Cursor Get
get Values At Positions from Cursor
//package com.java2s; import android.database.Cursor; import java.util.ArrayList; import java.util.Iterator; import java.util.List; public class Main { public static List getValuesAtPositions(Cursor cursor, int i, List list) { java.util.ArrayList arraylist = new ArrayList(); Integer integer;//w w w . ja va2 s .c o m Iterator iterator = list.iterator(); do { if (!iterator.hasNext()) return arraylist; integer = (Integer) iterator.next(); if (!cursor.moveToPosition(integer.intValue())) break; arraylist.add(cursor.getString(i)); } while (true); return arraylist; } public static String getString(Cursor cursor, String s) { return cursor.getString(cursor.getColumnIndexOrThrow(s)); } }