Package android.database

Examples of android.database.Cursor.moveToFirst()


     * Store highest image id from image table
     */
    private void setMaxIdFromDatabase() {
        String columns[] = new String[]{Media._ID, Media.DISPLAY_NAME, Media.MINI_THUMB_MAGIC};
        Cursor cursor = managedQuery( Media.EXTERNAL_CONTENT_URI, columns, null, null, Media._ID + " DESC" );
        maxId = cursor.moveToFirst() ? cursor.getInt( cursor.getColumnIndex( Media._ID ) ) : -1;
    }

    /**
     * Set highest image id
     *
 
View Full Code Here


    public int getId() {
        String[] columns = new String[]{Media._ID, Media.ORIENTATION};
        Cursor cursor = application.managedQuery( Media.EXTERNAL_CONTENT_URI, columns, null, null, Media._ID + " DESC" );

        // check if table has any rows at all
        if( !cursor.moveToFirst() ) {
            return -1;
        }

        // get latest id from db and stored id in application
        latestId = cursor.getInt( cursor.getColumnIndex( Media._ID ) );
View Full Code Here

            // get latest image from table
            Uri image = ContentUris.withAppendedId( Media.EXTERNAL_CONTENT_URI, latestId );
            Cursor cursor = application.managedQuery( image, columns, null, null, null );

            // check if cursus has rows, if not break and exit loop
            if( cursor.moveToFirst() ) {
                // get thumbnail field
                String imageThumb = cursor.getString( cursor.getColumnIndex( Media.MINI_THUMB_MAGIC ) );

                // if thumbnail field is not null it means image is written to sdcard
                // create new image item and break loop otherwise restart loop to check again
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.