Android Hacks - Hack32

  • Published on
    24-May-2015

  • View
    1.246

  • Download
    3

Embed Size (px)

DESCRIPTION

Android Hacks & ()http://www.oreilly.co.jp/books/9784873114569/

Transcript

  • 1. Hack 32

2. #32

  • MediaStore

3. #32

  • MediaStore
    • DB
        • iPod
  • Sdcard MediaScan DB

4. #32

  • MediaStore
    • MediaStore MediaStore DB
      • MediaStore
    • Android2.3 Bluetooth OPP Garaly3D MediaScan(scanFile)

5. #32

  • ContentResolver
  • ContentResolver Activity getContentResolver
    • ContentResolver cr = getContentResolver()

6. #32

  • getContentResolver()
    • ContentProvider (Permission)
      • Interface to global information about an application environment. This is an abstract class whose implementation is provided by the Android system. It allows access to application-specific resources and classes, as well as up-calls for application-level operations such as launching activities, broadcasting and receiving intents, etc.
        • (Allows)

7. #32

  • DB query
  • #32

String[] columns = { MediaStore.Images.Media. DATA ,// MediaStore.Images.Media. DISPLAY_NAME // }; MediaStore MediaStore.MediaColumns http://developer.android.com/reference/android/provider/MediaStore.MediaColumns.html 8. #32

  • Cursor

mCursor = cr.query(MediaStore.Images.Media. EXTERNAL_CONTENT_URI , columns, null , null , MediaStore.Images.Media. DEFAULT_SORT_ORDER ); String[] columns = { MediaStore.Images.Media. DATA ,// MediaStore.Images.Media. DISPLAY_NAME // }; 9. #32

  • row

// Cursor if (mCursor !=null ) { mCursor.moveToFirst(); showImage(); } // columnIndex = mCursor.getColumnIndex(MediaStore.Images.Media. DISPLAY_NAME ); columnName = mCursor.getString(columnIndex); 10. #32

move(int offset) moveToFirst() moveToLast() moveToNext() moveToPrevious() moveToPosition(int absolutePosition) 11. #32

ContentResolver getContentResolver ContentResolver query select XXX from YYY ContentResolver query query 12.

  • Android Hacks http://www.oreilly.co.jp/books/9784873114569/