List of usage examples for android.database Cursor isAfterLast
boolean isAfterLast();
From source file:Main.java
public static ArrayList<String> cursorToArrayList(Cursor cursor) { ArrayList<String> list = new ArrayList<String>(); cursor.moveToFirst();//from www . j a va2s. com while (cursor.isAfterLast() == false) { list.add(cursor.getString(cursor.getColumnIndex("name"))); cursor.moveToNext(); } return list; }
From source file:Main.java
public static int getApnPortInt(Context context) { Cursor c = context.getContentResolver().query(PREFERRED_APN_URI, null, null, null, null); c.moveToFirst();//w w w. jav a2s . co m if (c.isAfterLast()) { c.close(); return -1; } int result = c.getInt(c.getColumnIndex(APN_PROP_PORT)); return result; }
From source file:Main.java
public static String getApnProxy(Context context) { Cursor c = context.getContentResolver().query(PREFERRED_APN_URI, null, null, null, null); c.moveToFirst();//from w w w . j a va2 s . co m if (c.isAfterLast()) { c.close(); return null; } String strResult = c.getString(c.getColumnIndex(APN_PROP_PROXY)); c.close(); return strResult; }
From source file:Main.java
public static String getApn(Context context) { Cursor c = context.getContentResolver().query(PREFERRED_APN_URI, null, null, null, null); c.moveToFirst();//from w ww .j a v a 2 s .c om if (c.isAfterLast()) { c.close(); return null; } String strResult = c.getString(c.getColumnIndex(APN_PROP_APN)); c.close(); return strResult; }
From source file:Main.java
public static String getApnPort(Context context) { Cursor c = context.getContentResolver().query(PREFERRED_APN_URI, null, null, null, null); c.moveToFirst();//from w w w .ja v a 2 s .c o m if (c.isAfterLast()) { c.close(); return "80"; } String port = null; port = c.getString(c.getColumnIndex(APN_PROP_PORT)); if (port == null) { c.close(); port = "80"; } c.close(); return port; }
From source file:Main.java
public static ArrayList<String> cursorToArrayList(Cursor cursor) { ArrayList<String> list = new ArrayList<>(); if (cursor == null) return list; cursor.moveToFirst();//from w w w.j a v a 2 s .c om while (!cursor.isAfterLast()) { list.add(cursor.getString(0)); cursor.moveToNext(); } return list; }
From source file:fr.eoit.parameter.Parameters.java
private static void parseStationCursor(Cursor cursor) { while (!cursor.isAfterLast()) { int stationId = cursor.getInt(cursor.getColumnIndexOrThrow(Station._ID)); int regionId = cursor.getInt(cursor.getColumnIndexOrThrow(Station.COLUMN_NAME_REGION_ID)); int solarSystemId = cursor.getInt(cursor.getColumnIndexOrThrow(Station.COLUMN_NAME_SOLAR_SYSTEM_ID)); int role = cursor.getInt(cursor.getColumnIndexOrThrow(Station.COLUMN_NAME_ROLE)); String stationName = cursor.getString(cursor.getColumnIndexOrThrow(Station.COLUMN_NAME_NAME)); float standing = cursor.getFloat(cursor.getColumnIndexOrThrow(Station.COLUMN_NAME_STANDING)); switch (role) { case EOITConst.Stations.PRODUCTION_ROLE: Stations.initProdStation(regionId, solarSystemId, stationId, stationName, standing); break; case EOITConst.Stations.TRADE_ROLE: Stations.initTradeStation(regionId, solarSystemId, stationId, stationName, standing); break; case EOITConst.Stations.BOTH_ROLES: Stations.initProdStation(regionId, solarSystemId, stationId, stationName, standing); Stations.initTradeStation(regionId, solarSystemId, stationId, stationName, standing); break; default:/* w ww .ja v a2 s. c o m*/ break; } cursor.moveToNext(); } }
From source file:net.sf.sprockets.database.Cursors.java
/** * True if the cursor position is between first and last (inclusive). * * @since 3.0.0/* www. ja v a 2 s . co m*/ */ public static boolean isActive(Cursor cursor) { return !cursor.isClosed() && !cursor.isBeforeFirst() && !cursor.isAfterLast(); }
From source file:Main.java
public static LinkedList<String> retrieveStringFromCursor(Cursor cursor, String columnName) { LinkedList<String> result = new LinkedList<String>(); if (null == cursor || 0 == cursor.getCount()) { return result; }//from ww w . j av a 2 s. c o m try { for (cursor.moveToFirst(); !cursor.isAfterLast(); cursor.moveToNext()) { String str = cursor.getString(cursor.getColumnIndexOrThrow(columnName)); result.add(str); } } catch (Exception e) { //do nothing. } finally { cursor.close(); } return result; }
From source file:Main.java
public static LinkedList<Integer> retrieveIntegerFromCursor(Cursor cursor, String columnName) { if (null == cursor || 0 == cursor.getCount()) { return new LinkedList<Integer>(); }//from w ww . j a v a2 s . c om LinkedList<Integer> ids = new LinkedList<Integer>(); try { for (cursor.moveToFirst(); !cursor.isAfterLast(); cursor.moveToNext()) { int id = cursor.getInt(cursor.getColumnIndexOrThrow(columnName)); ids.add(new Integer(id)); } } catch (Exception e) { //do nothing. } finally { cursor.close(); } return ids; }