Cursor isAfterLast - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Cursor isAfterLast method.

This code example shows how to use the following methods:getColumnIndexOrThrow, getString, isAfterLast, moveToPosition
                args, R.string.user_dict_settings_add_dialog_title, null, null, 0);
    } 
 
    private String getWord(final int position) {
        if (null == mCursor) return null;
        mCursor.moveToPosition(position);
        // Handle a possible race-condition 
        if (mCursor.isAfterLast()) return null;
 
        return mCursor.getString(
                mCursor.getColumnIndexOrThrow(UserDictionary.Words.WORD));
    } 
 
    private String getShortcut(final int position) {
        if (null == mCursor) return null;
        mCursor.moveToPosition(position);
        // Handle a possible race-condition 
        if (mCursor.isAfterLast()) return null;
 
        return mCursor.getString(

8
CodeRank
This code example shows how to use the following methods:getCount, getLong, getString, isAfterLast, isLast
        addJulie(); 
 
        assertThat(updateName("Belvedere")).isEqualTo(2); 
 
        Cursor cursor = database.query("table_name", new String[]{"id", "name"}, null, null, null, null, null);
        assertThat(cursor.moveToFirst()).isTrue();
        assertThat(cursor.getCount()).isEqualTo(2);
 
        assertIdAndName(cursor, 1234L, "Belvedere");
        assertThat(cursor.moveToNext()).isTrue();
 
        assertIdAndName(cursor, 1235L, "Belvedere");
        assertThat(cursor.isLast()).isTrue();
        assertThat(cursor.moveToNext()).isFalse();
        assertThat(cursor.isAfterLast()).isTrue();
        assertThat(cursor.moveToNext()).isFalse();
    } 
 
    @Test 
    public void testDelete() throws Exception { 

8
CodeRank
This code example shows how to use the following methods:getCount, getString, isAfterLast, moveToFirst
		                                items, 
		                                null, 
		                                null,  
		                                MediaStore.Images.Media._ID + " desc");
		 
		if( cursor != null && cursor.getCount()>0 )
		{ 
			cursor.moveToFirst();
			for( cursor.moveToFirst(); !cursor.isAfterLast(); cursor.moveToNext() )
			{ 
				latestImage = cursor.getString(1);
				break; 
			} 
		} 
		 
	    return latestImage;
	} 
	 
	/** 
	 * 计算缩放图片的宽高 
7
CodeRank
This code example shows how to use the following methods:close, getBlob, getColumnIndex, isAfterLast, moveToFirst
        Cursor cursor = builder.query(db, columns, selection, selectionArgs,
                groupBy, having, sortOrder);
 
        if (cursor == null) {
            return null; 
        } else if (!cursor.moveToFirst()) {
            cursor.close();
            return null; 
        } 
        return cursor;
    } 
 
    public SortedMap<Long, Sample> queryOldestSamples(int howmany) {
        SortedMap<Long, Sample> results = new TreeMap<Long, Sample>();
        try { 
            synchronized (dbLock) {
                if (db == null || !db.isOpen()) {
                	try{ 
                		db = helper.getWritableDatabase();
                	}catch (android.database.sqlite.SQLiteException ex){

7
CodeRank
This code example shows how to use the following methods:getCount, getPosition, isAfterLast, isBeforeFirst, moveToFirst
		return cursor.getColumnName(column - 1);
	} 
 
	@Override 
    public int getColumnType(int column) throws SQLException {
        int oldPos = cursor.getPosition();
        boolean moved = false;
        if (cursor.isBeforeFirst() || cursor.isAfterLast()) {
            boolean resultSetEmpty = cursor.getCount() == 0 || cursor.isAfterLast();
            if (resultSetEmpty) {
                return Types.NULL;
            } 
            cursor.moveToFirst();
            moved = true;
        } 
        int nativeType = getType(cursor, column - 1);
        int type;
        switch (nativeType) {
        case 0: // Cursor.FIELD_TYPE_NULL: 
            type = Types.NULL;

7
CodeRank
This code example shows how to use the following methods:getInt, getString, isAfterLast, isBeforeFirst, isClosed
		} 
	} 
 
	@Override 
	public Segment loadFromCursor(Cursor cursor) {
		if (cursor.isBeforeFirst() || cursor.isAfterLast() || cursor.isClosed()) {
			throw new IllegalArgumentException();
		} 
 
		SimpleDateFormat sdf = new SimpleDateFormat(LAST_UPDATE_FORMAT);
		Segment segment = new Segment();
		int index = 1; // 0 == _ID
 
		segment.setName(cursor.getString(index++));
		segment.setColorId(cursor.getInt(index++));
		try { 
			segment.setLastUpdate(sdf.parse(cursor.getString(index++)));
		} catch (ParseException e) {
			segment.setLastUpdate(null);
		} 

7
CodeRank
This code example shows how to use the following methods:getDouble, getInt, getString, isAfterLast, isBeforeFirst
	// 
	// METHODES DE TRAITEMENTS DE CURSOR 
	// 
 
	public ParkingEntity loadFromCursor(Cursor cursor) {
		if (cursor.isBeforeFirst() || cursor.isAfterLast() || cursor.isClosed()) {
			throw new IllegalArgumentException();
		} 
 
		ParkingEntity park = new ParkingEntity();
		int index = 1; // 0 == _ID
 
		park.setIdentifiant(cursor.getString(index++));
		park.setNom(cursor.getString(index++));
		park.setStatut(cursor.getInt(index++));
		park.setPriorite(cursor.getInt(index++));
		park.setDisponibles(cursor.getInt(index++));
		park.setSeuilComplet(cursor.getInt(index++));
		park.setPlacesTotales(cursor.getInt(index++));
		park.setHoraires(cursor.getString(index++));

7
CodeRank
This code example shows how to use the following methods:close, getInt, isAfterLast, moveToFirst
 
    private void calculateZoomConstraints() { 
        if (this.isDatabaseAvailable()) {
            String[] projection = { "min(zoom_level)", "max(zoom_level)" };
            Cursor c = this.mDatabase.query("tiles", projection, null, null, null, null, null);
            c.moveToFirst();
            if (!c.isAfterLast()) {
                this.mMinimumZoom = c.getInt(0);
                this.mMaximumZoom = c.getInt(1);
            } 
            c.close();
        } 
    } 
 
    private boolean isDatabaseAvailable() { 
        return (this.mDatabase != null) && (this.mDatabase.isOpen());
    } 
 
} 
7
CodeRank
This code example shows how to use the following methods:getInt, getString, isAfterLast
     */ 
    class CombinedCursor extends CursorSource { 
 
        @Override 
        public SuggestItem getItem() { 
            if ((mCursor != null) && (!mCursor.isAfterLast())) {
                String title = mCursor.getString(1);
                String url = mCursor.getString(2);
                boolean isBookmark = (mCursor.getInt(3) == 1);
                return new SuggestItem(getTitle(title, url), getUrl(title, url),
                        isBookmark ? TYPE_BOOKMARK : TYPE_HISTORY);
            } 
            return null; 
        } 
 
        @Override 
        public void runQuery(CharSequence constraint) {
            // constraint != null 
            if (mCursor != null) {
                mCursor.close();
7
CodeRank
This code example shows how to use the following methods:isAfterLast
    return wrappedCursor.isBeforeFirst();
  } 
 
  @Implementation 
  public boolean isAfterLast() { 
    return wrappedCursor.isAfterLast();
  } 
 
  @Implementation 
  public int getColumnIndex(String s) {
    return wrappedCursor.getColumnIndex(s);
  } 
 
  @Implementation 
  public int getColumnIndexOrThrow(String s) throws IllegalArgumentException {
    return wrappedCursor.getColumnIndexOrThrow(s);
  } 
 
  @Implementation 
  public String getColumnName(int i) {
7
CodeRank

Related Cursor isAfterLast Questions & Answers:

isAfterLast Method Overview
Returns whether the cursor is pointing to the position after the last row.
See Code Examples for other Android Cursor Methods: