当前位置: 首页>>代码示例>>Java>>正文


Java Cursor.moveToNext方法代码示例

本文整理汇总了Java中android.database.Cursor.moveToNext方法的典型用法代码示例。如果您正苦于以下问题:Java Cursor.moveToNext方法的具体用法?Java Cursor.moveToNext怎么用?Java Cursor.moveToNext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.database.Cursor的用法示例。


在下文中一共展示了Cursor.moveToNext方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getAlbumArtPicPath

import android.database.Cursor; //导入方法依赖的package包/类
private synchronized String getAlbumArtPicPath(Context context, String albumId) {

        // 小米应用商店检测crash ,错误信息:[31188,0,com.duan.musicoco,13155908,java.lang.IllegalStateException,Unknown URL: content://media/external/audio/albums/null,Parcel.java,1548]
        if (!StringUtils.isReal(albumId)) {
            return null;
        }

        String[] projection = {MediaStore.Audio.Albums.ALBUM_ART};
        String imagePath = null;
        Uri uri = Uri.parse("content://media" + MediaStore.Audio.Albums.EXTERNAL_CONTENT_URI.getPath() + "/" + albumId);

        Cursor cur = context.getContentResolver().query(uri, projection, null, null, null);
        if (cur == null) {
            return null;
        }

        if (cur.getCount() > 0 && cur.getColumnCount() > 0) {
            cur.moveToNext();
            imagePath = cur.getString(0);
        }
        cur.close();


        return imagePath;
    }
 
开发者ID:DuanJiaNing,项目名称:Musicoco,代码行数:26,代码来源:MediaManager.java

示例2: getCalendarIdForName

import android.database.Cursor; //导入方法依赖的package包/类
public String getCalendarIdForName(String calendarName) {
    String selection = "(" + CalendarContract.Calendars.NAME + " = ?)";
    String[] selectionArgs = new String[] {calendarName};
    Cursor cursor = contentResolver.query(CALENDAR_URI, FIELDS, selection, selectionArgs, null);

    try {
        if (cursor.getCount() > 0) {
            while (cursor.moveToNext()) {
                String id = cursor.getString(0);
                return id;
            }
        }
    } catch (AssertionError ex) { /*TODO: log exception and bail*/ }

    return "";
}
 
开发者ID:schul-cloud,项目名称:schulcloud-mobile-android,代码行数:17,代码来源:CalendarContentUtil.java

示例3: getAllUndoneTasks

import android.database.Cursor; //导入方法依赖的package包/类
public ArrayList<DayTask> getAllUndoneTasks(){
    SQLiteDatabase db = this.getReadableDatabase();
    ArrayList<DayTask> tasks = new ArrayList<>();
    String query = "SELECT * FROM " + VARS.TABLE_NAME + " WHERE " + VARS.STATUS + " = 'false'";
    Cursor cursor = db.rawQuery(query, null);
    cursor.moveToFirst();
    while(!cursor.isAfterLast()){
        DayTask dayTask = new DayTask(cursor.getInt(cursor.getColumnIndex(VARS.ID_NAME)), cursor.getString(cursor.getColumnIndex(VARS.STATUS)),
                cursor.getString(cursor.getColumnIndex(VARS.TITLE)), cursor.getString(cursor.getColumnIndex(VARS.DESCRIPTION)),
                cursor.getString(cursor.getColumnIndex(VARS.DATE)), cursor.getString(cursor.getColumnIndex(VARS.TIME)));
        tasks.add(dayTask);
        cursor.moveToNext();
    }
    cursor.close();
    db.close();
    return tasks;
}
 
开发者ID:mehedi-shafi,项目名称:My-Day,代码行数:18,代码来源:DatabaseHandler.java

示例4: getDecks

import android.database.Cursor; //导入方法依赖的package包/类
public ArrayList<Deck> getDecks(int courseID){
    ArrayList<Deck> deckList = new ArrayList<Deck>();
    String selectQuery = "SELECT * FROM " + TABLE_DECK_DETAIL + " WHERE " + COURSE_ID + "=" + courseID;
    SQLiteDatabase db = this.getReadableDatabase();
    Cursor cursor = db.rawQuery(selectQuery, null);

    cursor.moveToFirst();
    System.out.println("DBHandler courseID in getDecks: " + courseID);
    //loop through all rows to return
    while(!cursor.isAfterLast()){
        Deck deck = new Deck(Integer.parseInt(cursor.getString(0)), courseID,
                cursor.getString(2), Integer.parseInt(cursor.getString(3)));
        deck.set_deckId(courseID);
        deckList.add(deck);

        //Log.i(TAG, "HERE WE ARE CourseID: " + courseID);
        cursor.moveToNext();
    }

    Log.i(TAG, "Return All Deck Names");
    db.close();

    return deckList;
}
 
开发者ID:ASU-CodeDevils,项目名称:FlashCards,代码行数:25,代码来源:DBHandler.java

示例5: listarActividadesSistema

import android.database.Cursor; //导入方法依赖的package包/类
public List<ActivityDataTransfer> listarActividadesSistema(){
    List<ActivityDataTransfer> retList = new ArrayList<>();

    String query = "SELECT * FROM " + TABLA_ACTIVIDADES;
    Cursor c = db.rawQuery(query, null);

    while(c.moveToNext()){
        int id = c.getInt(c.getColumnIndex(KEY_ID));
        String actividad = c.getString(c.getColumnIndex(KEY_ACTIVIDAD));
        Date fCreacion = getDateFromSqlite(c.getString(c.getColumnIndex(KEY_FECHACREACION)));
        String url = c.getString(c.getColumnIndex(KEY_URL_IMAGE));

        ActivityDataTransfer activityDataTransfer = new ActivityDataTransfer(id, actividad, fCreacion, url);
        retList.add(activityDataTransfer);
    }

    return retList;
}
 
开发者ID:TfgReconocimientoPulseras,项目名称:TrainAppTFG,代码行数:19,代码来源:DatabaseAdapter.java

示例6: loadInBackground

import android.database.Cursor; //导入方法依赖的package包/类
@Override
public Cursor loadInBackground() {
    Cursor albums = super.loadInBackground();
    MatrixCursor allAlbum = new MatrixCursor(COLUMNS);
    int totalCount = 0;
    String allAlbumCoverPath = "";
    if (albums != null) {
        while (albums.moveToNext()) {
            totalCount += albums.getInt(albums.getColumnIndex(COLUMN_COUNT));
        }
        if (albums.moveToFirst()) {
            allAlbumCoverPath = albums.getString(albums.getColumnIndex(MediaStore.MediaColumns.DATA));
        }
    }
    allAlbum.addRow(new String[]{Album.ALBUM_ID_ALL, Album.ALBUM_ID_ALL, Album.ALBUM_NAME_ALL, allAlbumCoverPath,
            String.valueOf(totalCount)});

    return new MergeCursor(new Cursor[]{allAlbum, albums});
}
 
开发者ID:zhihu,项目名称:Matisse,代码行数:20,代码来源:AlbumLoader.java

示例7: createObjects

import android.database.Cursor; //导入方法依赖的package包/类
private List<T> createObjects(Cursor c) {
	List<T> items = new ArrayList<T>();
	
	while(c.moveToNext()) {
		T object = Model.createObject(mClass, c);
		
		if(object != null) {
			items.add(object);
		}
	}
	
	return items;
}
 
开发者ID:Linguaculturalists,项目名称:Phoenicia,代码行数:14,代码来源:QuerySet.java

示例8: getPlaylistSongList

import android.database.Cursor; //导入方法依赖的package包/类
@NonNull
public static ArrayList<PlaylistSong> getPlaylistSongList(@NonNull final Context context, final int playlistId) {
    ArrayList<PlaylistSong> songs = new ArrayList<>();
    Cursor cursor = makePlaylistSongCursor(context, playlistId);

    if (cursor != null && cursor.moveToFirst()) {
        do {
            songs.add(getPlaylistSongFromCursorImpl(cursor, playlistId));
        } while (cursor.moveToNext());
    }
    if (cursor != null) {
        cursor.close();
    }
    return songs;
}
 
开发者ID:aliumujib,项目名称:Orin,代码行数:16,代码来源:PlaylistSongLoader.java

示例9: query

import android.database.Cursor; //导入方法依赖的package包/类
public SosContacter query(){
    Cursor cursor=db.rawQuery("select * from tb_sos where ischecked=1",null);
    if(cursor.moveToNext()){
        return  new SosContacter(cursor.getInt(cursor.getColumnIndex("_id")),cursor.getString(cursor.getColumnIndex("name")),
                cursor.getString(cursor.getColumnIndex("relation")),cursor.getString(cursor.getColumnIndex("phone")),
                cursor.getString(cursor.getColumnIndex("content")),cursor.getInt(cursor.getColumnIndex("ischecked")));
    }
    return null;
}
 
开发者ID:fergus825,项目名称:SmartOrnament,代码行数:10,代码来源:SosContacterDAO.java

示例10: getGroupMemberLimit

import android.database.Cursor; //导入方法依赖的package包/类
public ArrayList<ContactBean> getGroupMemberLimit(int pageSkip, int maxCount, String table) {

        ArrayList<ContactBean> gbList = new ArrayList<ContactBean>();
        try {
            String selectQuery = "SELECT " + MEMBER_NAME + ", " + MEMBER_PHONE + ", " + MEMBER_SEARCHKEY + ", " + MEMBER_UID + ", " + MEMBER_FLAG + ", " + MEMBER_ORG_NAME + ", "
                    + MEMBER_PH_BOK_NAME + ", " + MEMBER_ISMY_CONTACT + ", " + MEMBER_BLOOD_GROUP + ", " + MEMBER_ADMIN_FLAG + ", " + MEMBER_CREATED_DATE + " FROM " + table + " Order by " + MEMBER_CREATED_DATE + " " + "LIMIT " + pageSkip + ", " + maxCount;

            SQLiteDatabase db = this.getWritableDatabase();
            Cursor cursor = db.rawQuery(selectQuery, null);
            // looping through all rows and adding to list
            if (cursor.moveToFirst()) {
                do {
                    ContactBean contact = new ContactBean();
                    contact.setName(cursor.getString(0));
                    contact.setNumber(cursor.getString(1));
                    contact.setSearchKey(cursor.getString(2));
                    contact.setUID(cursor.getString(3));
                    contact.setRequestFlag(cursor.getString(4));
                    contact.setOrignalName(cursor.getString(5));
                    contact.setMyPhoneBookName(cursor.getString(6));
                    contact.setIsMyContact(cursor.getInt(7));
                    contact.setmBloodGroup(cursor.getString(8));
                    contact.setAdminFlag(cursor.getString(9));
                    contact.setmCreatedDate(cursor.getString(10));
                    gbList.add(contact);
                } while (cursor.moveToNext());
            }
            if (cursor != null)
                cursor.close();
            db.close();
        } catch (Exception e) {
            // TODO: handle exception
            //Log.e("GroupDBErro", "FetchAllDB " + e.getMessage());
            e.printStackTrace();
        }
        return gbList;
    }
 
开发者ID:mityung,项目名称:XERUNG,代码行数:38,代码来源:GroupDb.java

示例11: findAllDownloading

import android.database.Cursor; //导入方法依赖的package包/类
@SuppressWarnings("No problem")
@Override
public List<DownloadInfo> findAllDownloading() {
  Cursor cursor = readableDatabase.query(DefaultDownloadHelper.TABLE_NAME_DOWNLOAD_INFO,
      DOWNLOAD_INFO_COLUMNS, "status!=?", new String[]{
          String.valueOf(STATUS_COMPLETED)}, null, null, "createAt desc");

  List<DownloadInfo> downloads = new ArrayList<>();
  Cursor downloadCursor;
  while (cursor.moveToNext()) {
    DownloadInfo downloadInfo = new DownloadInfo();
    downloads.add(downloadInfo);

    inflateDownloadInfo(cursor, downloadInfo);

    //query download thread info
    downloadCursor = readableDatabase.query(DefaultDownloadHelper.TABLE_NAME_DOWNLOAD_THREAD_INFO,
        DOWNLOAD_THREAD_INFO_COLUMNS, "downloadInfoId=?", new String[]{
            String.valueOf(downloadInfo.getId())}, null, null, null);
    List<DownloadThreadInfo> downloadThreads = new ArrayList<>();
    while (downloadCursor.moveToNext()) {
      DownloadThreadInfo downloadThreadInfo = new DownloadThreadInfo();
      downloadThreads.add(downloadThreadInfo);
      inflateDownloadThreadInfo(downloadCursor, downloadThreadInfo);
    }

    downloadInfo.setDownloadThreadInfos(downloadThreads);

  }
  return downloads;
}
 
开发者ID:lifengsofts,项目名称:AndroidDownloader,代码行数:32,代码来源:DefaultDownloadDBController.java

示例12: log_queue_over_logLevel

import android.database.Cursor; //导入方法依赖的package包/类
@Test
public void log_queue_over_logLevel() throws InterruptedException {
  historian.initialize();

  historian.log(Log.INFO, TAG, "this is info1");
  historian.log(Log.DEBUG, TAG, "this is debug1");
  historian.log(Log.INFO, TAG, "this is info2");
  historian.log(Log.WARN, TAG, "this is warn1");
  historian.log(Log.ERROR, TAG, "this is error1");

  Thread.sleep(500);

  Cursor cursor = getAllLogs(historian);

  assertEquals(4, cursor.getCount());

  cursor.moveToFirst();
  assertEquals("INFO", Cursors.getString(cursor, "priority"));
  assertEquals(TAG, Cursors.getString(cursor, "tag"));
  assertEquals("this is info1", Cursors.getString(cursor, "message"));

  cursor.moveToNext();
  assertEquals("INFO", Cursors.getString(cursor, "priority"));
  assertEquals(TAG, Cursors.getString(cursor, "tag"));
  assertEquals("this is info2", Cursors.getString(cursor, "message"));

  cursor.moveToNext();
  assertEquals("WARN", Cursors.getString(cursor, "priority"));
  assertEquals(TAG, Cursors.getString(cursor, "tag"));
  assertEquals("this is warn1", Cursors.getString(cursor, "message"));

  cursor.moveToNext();
  assertEquals("ERROR", Cursors.getString(cursor, "priority"));
  assertEquals(TAG, Cursors.getString(cursor, "tag"));
  assertEquals("this is error1", Cursors.getString(cursor, "message"));

  cursor.close();
}
 
开发者ID:yshrsmz,项目名称:historian,代码行数:39,代码来源:HistorianTest.java

示例13: getAllArtists

import android.database.Cursor; //导入方法依赖的package包/类
public static List<Artist> getAllArtists() {
    List<Artist> artistList = new ArrayList<>();
    Cursor cursor = makeArtistCursor(MusicApplication.getContext());
    // Gather the data
    if (cursor != null && cursor.moveToFirst()) {
        do {
            // Copy the artist id
            final long id = cursor.getLong(0);

            // Copy the artist name
            final String artistName = cursor.getString(1);

            // Copy the number of albums
            final int albumCount = cursor.getInt(2);

            // Copy the number of songs
            final int songCount = cursor.getInt(3);

            // as per designer's request, don't show unknown artist
            if (MediaStore.UNKNOWN_STRING.equals(artistName)) {
                continue;
            }

            // Create a new artist
            final Artist artist = new Artist(id, artistName, songCount, albumCount);
            artistList.add(artist);
        } while (cursor.moveToNext());
    }
    // Close the cursor
    if (cursor != null) {
        cursor.close();
        cursor = null;
    }
    return artistList;
}
 
开发者ID:komamj,项目名称:KomaMusic,代码行数:36,代码来源:ArtistsPresenter.java

示例14: exportSingleIndex

import android.database.Cursor; //导入方法依赖的package包/类
private static void exportSingleIndex(SQLiteDatabase db, String tableName, BufferedWriter writer) throws IOException {
    String sql = "SELECT sql FROM sqlite_master WHERE type = 'index' AND tbl_name='" + tableName + "'";
    Cursor cursor = db.rawQuery(sql, null);
    if (cursor == null) return;

    while (cursor.moveToNext()) {
        if (cursor.getString(0) == null)
            continue;

        writer.write(cursor.getString(0) + ";" + NL + NL);
    }
    cursor.close();
}
 
开发者ID:WeiMei-Tian,项目名称:editor-sql,代码行数:14,代码来源:ExportTool.java

示例15: getAllRecordDetails

import android.database.Cursor; //导入方法依赖的package包/类
public List<RecordDetailsModel> getAllRecordDetails() {
    final List<RecordDetailsModel> listRecordDetails = new ArrayList<>();

    final Cursor cursor = getDatabase().query(DataBaseHelper.TABLE_RECORDS_DETAILS,
            allColumns, null, null, null, null, null);

    cursor.moveToFirst();
    while (!cursor.isAfterLast()) {
        RecordDetailsModel recordDetailsModel = cursorToRecordDetails(cursor);
        listRecordDetails.add(recordDetailsModel);
        cursor.moveToNext();
    }
    cursor.close();
    return listRecordDetails;
}
 
开发者ID:WorldBank-Transport,项目名称:RoadLab-Pro,代码行数:16,代码来源:RecordDetailsDAO.java


注:本文中的android.database.Cursor.moveToNext方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。