当前位置: 首页>>代码示例>>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;未经允许,请勿转载。