當前位置: 首頁>>代碼示例>>Java>>正文


Java Cursor.isAfterLast方法代碼示例

本文整理匯總了Java中android.database.Cursor.isAfterLast方法的典型用法代碼示例。如果您正苦於以下問題:Java Cursor.isAfterLast方法的具體用法?Java Cursor.isAfterLast怎麽用?Java Cursor.isAfterLast使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.database.Cursor的用法示例。


在下文中一共展示了Cursor.isAfterLast方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getExplainQueryPlan

import android.database.Cursor; //導入方法依賴的package包/類
private String[] getExplainQueryPlan() {
    Cursor cursor = db.rawQuery("EXPLAIN QUERY PLAN " + query, queryArgs);
    String[] plan = new String[cursor.getCount()];
    cursor.moveToFirst();
    while (!cursor.isAfterLast()) {
        // The docs at https://sqlite.org/eqp.html talk about how the output format of
        // EXPLAIN QUERY PLAN can change between SQLite versions. This has been observed
        // between the sqlite versions on Android 2.3.3 and Android 5.0. However, it seems
        // that the last column is always the one with the interesting details that we wish
        // to log. If this fails for some reason, then hey, it is only for debug builds, right?
        if (cursor.getColumnCount() > 0) {
            int index = cursor.getColumnCount() - 1;
            plan[cursor.getPosition()] = cursor.getString(index);
        }
        cursor.moveToNext();
    }
    cursor.close();
    return plan;
}
 
開發者ID:uhuru-mobile,項目名稱:mobile-store,代碼行數:20,代碼來源:LoggingQuery.java

示例2: getAllPlants

import android.database.Cursor; //導入方法依賴的package包/類
public ArrayList<Plant> getAllPlants() {
    ArrayList<Plant> array_list = new ArrayList<Plant>();

    SQLiteDatabase db = this.getReadableDatabase();
    Cursor res =  db.rawQuery( "SELECT id, name, start_date, image FROM plants", null );
    res.moveToFirst();

    while(res.isAfterLast() == false) {
        int id = res.getInt(res.getColumnIndex("id"));
        String name = res.getString(res.getColumnIndex(PLANTS_COLUMN_NAME));
        String startDate = res.getString(res.getColumnIndex(PLANTS_COLUMN_START_DATE));
        String image = res.getString(res.getColumnIndex(PLANTS_COLUMN_IMAGE));
        Plant p = new Plant(id, name, startDate, image);
        array_list.add(p);
        res.moveToNext();
    }
    db.close();
    return array_list;
}
 
開發者ID:smoriarty21,項目名稱:grow-tracker-android,代碼行數:20,代碼來源:DBHelper.java

示例3: findtables

import android.database.Cursor; //導入方法依賴的package包/類
public int findtables(String tablename)
{
    int flag = 0 ;
    SQLiteDatabase db= getReadableDatabase();
    String query = "select name from sqlite_master where type='table'";
    Cursor c= db.rawQuery(query,null);
    c.moveToFirst();
    while(!c.isAfterLast())
    {
        String s = c.getString(c.getColumnCount()-1);
        Log.d("table "+c.getPosition()," name "+s);
        if(s.equals(tablename))
            flag = 1;

        c.moveToNext();
    }
    c.close();
    return flag ;
}
 
開發者ID:mdnafiskhan,項目名稱:Mp3Player,代碼行數:20,代碼來源:DataBaseClass.java

示例4: getSuraNameByID

import android.database.Cursor; //導入方法依賴的package包/類
/**
 * Function to get sura name
 *
 * @param suraID Sura id
 * @return Object of sura name
 */
public Sora getSuraNameByID(int suraID) {

    Sora sora = null;
    try {
        SQLiteDatabase db = openDB(MAIN_DATABASE);
        String sql = "select * from sora where soraid = " + suraID + " ; ";
        Cursor cursor = db.rawQuery(sql, null);
        cursor.moveToFirst();
        while (!cursor.isAfterLast()) {
            sora = new Sora(cursor.getString(1), cursor.getString(2));
            cursor.moveToNext();
        }
        cursor.close();
        closeDB(db);

    } catch (Exception e) {
        e.printStackTrace();
    }
    return sora;

}
 
開發者ID:fekracomputers,項目名稱:QuranAndroid,代碼行數:28,代碼來源:DatabaseAccess.java

示例5: selectUpcomingGames

import android.database.Cursor; //導入方法依賴的package包/類
/**
 * Used to get games that are queued for today. Used in dashboard, creating game notifications and calculating no of games for each league while creating new grid.
 *
 * @return List of games for today.
 */

public List<Game> selectUpcomingGames(int lag) {
    SQLiteDatabase db = getReadableDatabase();

    String[] selectionArgs = {
            String.valueOf(new DateTime(Constants.DATE.VEGAS_TIME_ZONE).minusDays(Constants.DATE_LAG + lag).withTimeAtStartOfDay().getMillis())};
    List<Game> data = new LinkedList<>();
    Cursor res = db.rawQuery("SELECT " + GameEntry._ID +
                    " FROM " + GameEntry.TABLE_NAME +
                    " WHERE " + GameEntry.COLUMN_GAME_ADD_DATE + EQUAL_SEP +
                    " ORDER BY " + GameEntry.COLUMN_GAME_DATE_TIME,
            selectionArgs);
    res.moveToFirst();

    while (!res.isAfterLast()) {
        Game game = onSelectGame(String.valueOf(res.getInt(res.getColumnIndex(GameEntry._ID))));
        if (checkBid(game) && checkGameValidity(game, lag)) {
            data.add(game);
        }
        res.moveToNext();

    }
    res.close();
    return data;
}
 
開發者ID:riteshakya037,項目名稱:Android-Scrapper,代碼行數:31,代碼來源:DatabaseContract.java

示例6: getAllTranslations

import android.database.Cursor; //導入方法依賴的package包/類
/**
 * Function to get all translation books , info and status
 *
 * @return List of translations
 */
public List<TranslationBook> getAllTranslations() {
    List<TranslationBook> translationBooks = new ArrayList<TranslationBook>();
    SQLiteDatabase db = openDB(MAIN_DATABASE);
    String sql = "select * from tafaseer ;";
    Cursor cursor = db.rawQuery(sql, null);
    cursor.moveToFirst();
    while (!cursor.isAfterLast()) {
        translationBooks.add(new TranslationBook(cursor.getInt(0),
                cursor.getString(1),
                cursor.getString(2) == null ? "" : cursor.getString(2),
                cursor.getInt(3),
                false,
                false));
        cursor.moveToNext();
    }

    cursor.close();
    closeDB(db);
    return translationBooks;
}
 
開發者ID:fekracomputers,項目名稱:QuranAndroid,代碼行數:26,代碼來源:DatabaseAccess.java

示例7: getAll

import android.database.Cursor; //導入方法依賴的package包/類
public ArrayList getAll() {
    ArrayList array_list = new ArrayList();
    SQLiteDatabase db = this.getReadableDatabase();
    Cursor res = db.rawQuery("select * from " + mynotes, null);
    res.moveToFirst();
    while (res.isAfterLast() == false) {
        array_list.add(res.getString(res.getColumnIndex("_id")));
        array_list.add(res.getString(res.getColumnIndex(remark)));
        array_list.add(res.getString(res.getColumnIndex(dates)));
        array_list.add(res.getString(res.getColumnIndex(name)));
        res.moveToNext();
    }
    return array_list;
}
 
開發者ID:dvinfosys,項目名稱:Notepad-For-Android,代碼行數:15,代碼來源:NDb.java

示例8: makePlaylistMenuOnline

import android.database.Cursor; //導入方法依賴的package包/類
/**
 * Same as makePlaylistMenu, but only for online provides
 *
 * @param context The context to use for creating the menu items
 * @param sub     The submenu to add the items to.
 */
public static void makePlaylistMenuOnline(Context context, SubMenu sub) {
    String[] cols = new String[]{MediaStore.Audio.Playlists._ID,
            MediaStore.Audio.Playlists.NAME};
    ContentResolver resolver = context.getContentResolver();
    if (resolver == null) {
    } else {
        String whereclause = MediaStore.Audio.Playlists.NAME + " != ''";
        Cursor cur = resolver.query(
                MediaStore.Audio.Playlists.EXTERNAL_CONTENT_URI, cols,
                whereclause, null, MediaStore.Audio.Playlists.NAME);
        sub.clear();
        sub.add(1, Defs.QUEUE, 0, R.string.queue);
        sub.add(1, Defs.NEW_PLAYLIST, 0, R.string.new_playlist);
        if (cur != null && cur.getCount() > 0) {
            // sub.addSeparator(1, 0);
            cur.moveToFirst();
            while (!cur.isAfterLast()) {
                if (cur.getLong(0) == MusicUtils.getPlaylistiD(cur
                        .getString(1))) {
                    Intent intent = new Intent();
                    intent.putExtra("playlist", cur.getLong(0));
                    intent.putExtra("name", cur.getString(1));
                    // if (cur.getInt(0) == mLastPlaylistSelected) {
                    // sub.add(0, MusicBaseActivity.PLAYLIST_SELECTED,
                    // cur.getString(1)).setIntent(intent);
                    // } else {
                    sub.add(1, Defs.PLAYLIST_SELECTED, 0, cur.getString(1))
                            .setIntent(intent);
                    // }
                }
                cur.moveToNext();
            }
        }
        if (cur != null) {
            cur.close();
        }
    }
}
 
開發者ID:89luca89,項目名稱:ThunderMusic,代碼行數:45,代碼來源:MusicUtils.java

示例9: getCallIds

import android.database.Cursor; //導入方法依賴的package包/類
/**
 * Returns the call ids for the given number of items in the cursor.
 * <p>
 * It uses the next {@code count} rows in the cursor to extract the types.
 * <p>
 * It position in the cursor is unchanged by this function.
 */
private long[] getCallIds(Cursor cursor, int count) {
    int position = cursor.getPosition();
    long[] callIds = new long[count];
    for (int index = 0; index < count; ++index) {
        if(!cursor.isAfterLast()) {
            callIds[index] = cursor.getLong(cursor.getColumnIndex(CallLog.Calls._ID));
        }
        cursor.moveToNext();
    }
    cursor.moveToPosition(position);
    return callIds;
}
 
開發者ID:treasure-lau,項目名稱:CSipSimple,代碼行數:20,代碼來源:CallLogAdapter.java

示例10: onLoadFinished

import android.database.Cursor; //導入方法依賴的package包/類
@Override
public void onLoadFinished(Loader<Cursor> cursorLoader, Cursor cursor) {
    List<String> emails = new ArrayList<>();
    cursor.moveToFirst();
    while (!cursor.isAfterLast()) {
        emails.add(cursor.getString(ProfileQuery.ADDRESS));
        cursor.moveToNext();
    }

    addEmailsToAutoComplete(emails);
}
 
開發者ID:DavidBorges,項目名稱:Book-Tea_Project,代碼行數:12,代碼來源:LoginActivity.java

示例11: movePropertiesFromBody

import android.database.Cursor; //導入方法依賴的package包/類
private static void movePropertiesFromBody(SQLiteDatabase db) {
    Cursor cursor = db.query("notes", new String[] { "_id", "content" }, null, null, null, null, null);

    try {
        for (cursor.moveToFirst(); !cursor.isAfterLast(); cursor.moveToNext()) {
            long noteId = cursor.getLong(0);
            String content = cursor.getString(1);

            if (!TextUtils.isEmpty(content)) {
                StringBuilder newContent = new StringBuilder();
                List<String[]> properties = getPropertiesFromContent(content, newContent);

                if (properties.size() > 0) {
                    int pos = 1;
                    for (String[] property: properties) {
                        long nameId = DbPropertyName.getOrInsert(db, property[0]);
                        long valueId = DbPropertyValue.getOrInsert(db, property[1]);
                        long propertyId = DbProperty.getOrInsert(db, nameId, valueId);
                        DbNoteProperty.getOrInsert(db, noteId, pos++, propertyId);
                    }

                    /* Update content and its line count */
                    ContentValues values = new ContentValues();
                    values.put("content", newContent.toString());
                    values.put("content_line_count", MiscUtils.lineCount(newContent.toString()));
                    db.update("notes", values, "_id = " + noteId, null);
                }
            }
        }
    } finally {
        cursor.close();
    }
}
 
開發者ID:orgzly,項目名稱:orgzly-android,代碼行數:34,代碼來源:DatabaseMigration.java

示例12: PageTranslation

import android.database.Cursor; //導入方法依賴的package包/類
/**
 * Function to get all page ayaat translation
 *
 * @param page Page number
 * @param book TranslationBook book number
 * @return Page information with translation
 */
public PageTranslation PageTranslation(int page, int book) {

    PageTranslation pageTranslation = null;
    List<AyaTranslation> ayaTranslations = new ArrayList<AyaTranslation>();
    String soraName = "";
    int jozaID = -1;
    int soraId = -1;
    SQLiteDatabase db = openDB(TRANSLATION_DATABASE);

    String sql = "select b.name , a.page , a.soraid , a.ayaid , a.joza " +
            "from aya a , sora b where page = " + page + " and b.soraid = a.soraid order by a.soraid  ;";
    Cursor cursor = db.rawQuery(sql, null);
    cursor.moveToFirst();
    if (!cursor.isAfterLast()) {
        soraName = cursor.getString(0);
        jozaID = cursor.getInt(4);
        ayaTranslations.add(getAyaTranslation(cursor.getInt(2),
                cursor.getInt(3),
                book));
        cursor.moveToNext();
    }
    pageTranslation = new PageTranslation(soraName,
            soraId,
            page,
            jozaID,
            ayaTranslations);

    cursor.close();
    closeDB(db);
    return pageTranslation;
}
 
開發者ID:fekracomputers,項目名稱:QuranAndroid,代碼行數:39,代碼來源:DatabaseAccess.java

示例13: onLoadFinished

import android.database.Cursor; //導入方法依賴的package包/類
@Override
public void onLoadFinished(Loader<Cursor> cursorLoader, Cursor cursor) {
    List<String> emails = new ArrayList<>();
    cursor.moveToFirst();
    while (!cursor.isAfterLast()) {
        emails.add(cursor.getString(ProfileQuery.ADDRESS));
        cursor.moveToNext();
    }
    addEmailsToAutoComplete(emails);
}
 
開發者ID:Luodian,項目名稱:Shared-Route,代碼行數:11,代碼來源:LoginActivity.java

示例14: getAllIssues

import android.database.Cursor; //導入方法依賴的package包/類
public List<IssuesModel> getAllIssues() {
    final List<IssuesModel> listIssues = new ArrayList<>();
    final Cursor cursor = getAllIssuesCursor();
    if (cursor != null) {
        cursor.moveToFirst();
        while (!cursor.isAfterLast()) {
            final IssuesModel issuesModel = cursorToIssues(cursor);
            listIssues.add(issuesModel);
            cursor.moveToNext();
        }
        cursor.close();
    }
    return listIssues;
}
 
開發者ID:WorldBank-Transport,項目名稱:RoadLab-Pro,代碼行數:15,代碼來源:IssuesDAO.java

示例15: getAllCotacts

import android.database.Cursor; //導入方法依賴的package包/類
public ArrayList<String> getAllCotacts() {
    ArrayList<String> arrayList = new ArrayList<>();

    //hp = new HashMap();
    SQLiteDatabase db = this.getReadableDatabase();
    Cursor res = db.rawQuery("select * from contacts", null);
    res.moveToFirst();

    while (!res.isAfterLast()) {
        arrayList.add(res.getString(res.getColumnIndex(CONTACTS_COLUMN_NAME)));
        res.moveToNext();
    }
    return arrayList;
}
 
開發者ID:kosiarska,項目名稱:ObjectBoxDebugBrowser,代碼行數:15,代碼來源:ContactDBHelper.java


注:本文中的android.database.Cursor.isAfterLast方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。