android Programming Glossary: mcontext.getcontentresolver
How do I display a contact's photo from the contact's id? http://stackoverflow.com/questions/11010928/how-do-i-display-a-contacts-photo-from-the-contacts-id contactUri Contacts.Photo.CONTENT_DIRECTORY Cursor cursor mContext.getContentResolver .query photoUri new String Contacts.Photo.DATA15 null null..
Loading large images without OutOfMemoryError http://stackoverflow.com/questions/11931742/loading-large-images-without-outofmemoryerror f new File path Uri uri Uri.fromFile f InputStream input mContext.getContentResolver .openInputStream uri Drawable d Drawable.createFromStream input..
differentiate inbox and sentsms from all sms http://stackoverflow.com/questions/11980788/differentiate-inbox-and-sentsms-from-all-sms accordingly. Psuedo code can be as below. Cursor cursor mContext.getContentResolver .query Uri .parse content sms null null null null String type..
Android How to send multiple contacts are attached in single .vcf file and send to mail? http://stackoverflow.com/questions/12798001/android-how-to-send-multiple-contacts-are-attached-in-single-vcf-file-and-send null String vfile null vfile Contacts.vcf Cursor phones mContext.getContentResolver .query ContactsContract.CommonDataKinds.Phone.CONTENT_URI null.. lookupKey AssetFileDescriptor fd try fd mContext.getContentResolver .openAssetFileDescriptor uri r FileInputStream fis fd.createInputStream..
AutoCompleteTextView backed by CursorLoader http://stackoverflow.com/questions/12854336/autocompletetextview-backed-by-cursorloader context mContext Messenger2 context mContentResolver mContext.getContentResolver mView this mAdapter new RecipientsCursorAdapter mContext 0 null..
How to query Android MediaStore Content Provider, avoiding orphaned images? http://stackoverflow.com/questions/3680357/how-to-query-android-mediastore-content-provider-avoiding-orphaned-images image. return MediaStore.Images.Thumbnails.getThumbnail mContext.getContentResolver originalImageId MediaStore.Images.Thumbnails.MICRO_KIND null..
How to store large blobs in an android content provider? http://stackoverflow.com/questions/3883211/how-to-store-large-blobs-in-an-android-content-provider scheme try d Drawable.createFromStream mContext.getContentResolver .openInputStream mUri null frameworks base core java android..
What is the correct permission handling when sending sensitive app data as email attachment? http://stackoverflow.com/questions/4179594/what-is-the-correct-permission-handling-when-sending-sensitive-app-data-as-email find in the method private Uri getPreAuthorizedUri Uri uri mContext.getContentResolver .call ContactsContract.AUTHORITY_URI ContactsContract.Authorization.AUTHORIZATION_METHOD..
Load contact photo in a listview performance http://stackoverflow.com/questions/5211665/load-contact-photo-in-a-listview-performance photoInputStream Contacts.openContactPhotoInputStream mContext.getContentResolver conUri if photoInputStream null return framePhoto BitmapFactory.decodeResource.. Bitmap photo framePhoto getPhoto mContext.getContentResolver conUri return photo Once the image is downloaded associates..
Homescreen shortcuts with icons http://stackoverflow.com/questions/7754953/homescreen-shortcuts-with-icons http mnt sdcard mytest test.png ContentResolver cr mContext.getContentResolver InputStream in in cr.openInputStream contentURI BitmapFactory.Options..
Android Save images to SQLite or SDCard or memory http://stackoverflow.com/questions/9273008/android-save-images-to-sqlite-or-sdcard-or-memory Bitmap bm MediaStore.Images.Thumbnails.getThumbnail mContext.getContentResolver selectedImageUri MediaStore.Images.Thumbnails.MICRO_KIND null..
How do I display a contact's photo from the contact's id? http://stackoverflow.com/questions/11010928/how-do-i-display-a-contacts-photo-from-the-contacts-id Long.parseLong contactId Uri photoUri Uri.withAppendedPath contactUri Contacts.Photo.CONTENT_DIRECTORY Cursor cursor mContext.getContentResolver .query photoUri new String Contacts.Photo.DATA15 null null null if cursor null return null try if cursor.moveToFirst byte..
Loading large images without OutOfMemoryError http://stackoverflow.com/questions/11931742/loading-large-images-without-outofmemoryerror to load it from the sdcard. Here's what I tried to do File f new File path Uri uri Uri.fromFile f InputStream input mContext.getContentResolver .openInputStream uri Drawable d Drawable.createFromStream input image In this case the InputStream is a FileInputStream..
differentiate inbox and sentsms from all sms http://stackoverflow.com/questions/11980788/differentiate-inbox-and-sentsms-from-all-sms method of ContentObserver and get the sms type and work accordingly. Psuedo code can be as below. Cursor cursor mContext.getContentResolver .query Uri .parse content sms null null null null String type cursor.getColumnIndex type if cursor.getString type .equalsIgnoreCase..
Android How to send multiple contacts are attached in single .vcf file and send to mail? http://stackoverflow.com/questions/12798001/android-how-to-send-multiple-contacts-are-attached-in-single-vcf-file-and-send getVcardString public static void getVcardString String path null String vfile null vfile Contacts.vcf Cursor phones mContext.getContentResolver .query ContactsContract.CommonDataKinds.Phone.CONTENT_URI null null null null phones.moveToFirst Log.i Number of contacts.. Uri uri Uri.withAppendedPath ContactsContract.Contacts.CONTENT_VCARD_URI lookupKey AssetFileDescriptor fd try fd mContext.getContentResolver .openAssetFileDescriptor uri r FileInputStream fis fd.createInputStream byte buf new byte int fd.getDeclaredLength fis.read..
AutoCompleteTextView backed by CursorLoader http://stackoverflow.com/questions/12854336/autocompletetextview-backed-by-cursorloader AttributeSet attrs super c attrs init c private void init Context context mContext Messenger2 context mContentResolver mContext.getContentResolver mView this mAdapter new RecipientsCursorAdapter mContext 0 null new String 0 new int 0 mContext mAdapter.setCursorToStringConverter..
How to query Android MediaStore Content Provider, avoiding orphaned images? http://stackoverflow.com/questions/3680357/how-to-query-android-mediastore-content-provider-avoiding-orphaned-images Get or create upon demand the micro thumbnail for the original image. return MediaStore.Images.Thumbnails.getThumbnail mContext.getContentResolver originalImageId MediaStore.Images.Thumbnails.MICRO_KIND null And the following code to load the original image from the..
How to store large blobs in an android content provider? http://stackoverflow.com/questions/3883211/how-to-store-large-blobs-in-an-android-content-provider ContentResolver.SCHEME_CONTENT.equals scheme ContentResolver.SCHEME_FILE.equals scheme try d Drawable.createFromStream mContext.getContentResolver .openInputStream mUri null frameworks base core java android widget ImageView.java I got it working. I took a hint from..
What is the correct permission handling when sending sensitive app data as email attachment? http://stackoverflow.com/questions/4179594/what-is-the-correct-permission-handling-when-sending-sensitive-app-data-as-email at com.android.contacts.detail.ContactLoaderFragment you find in the method private Uri getPreAuthorizedUri Uri uri mContext.getContentResolver .call ContactsContract.AUTHORITY_URI ContactsContract.Authorization.AUTHORIZATION_METHOD null uriBundle Which resolves to..
Load contact photo in a listview performance http://stackoverflow.com/questions/5211665/load-contact-photo-in-a-listview-performance params url params 0 Uri conUri Uri.parse url InputStream photoInputStream Contacts.openContactPhotoInputStream mContext.getContentResolver conUri if photoInputStream null return framePhoto BitmapFactory.decodeResource mContext.getResources R.drawable.ic_contact_list_picture.. mContext.getResources R.drawable.ic_contact_list_picture Bitmap photo framePhoto getPhoto mContext.getContentResolver conUri return photo Once the image is downloaded associates it to the imageView @Override protected void onPostExecute..
Homescreen shortcuts with icons http://stackoverflow.com/questions/7754953/homescreen-shortcuts-with-icons an drawable icon. The following code try Uri contentURI Uri.parse http mnt sdcard mytest test.png ContentResolver cr mContext.getContentResolver InputStream in in cr.openInputStream contentURI BitmapFactory.Options options new BitmapFactory.Options options.inSampleSize..
Android Save images to SQLite or SDCard or memory http://stackoverflow.com/questions/9273008/android-save-images-to-sqlite-or-sdcard-or-memory selectedImageUri ContentUris.parseId Uri.parse anniEntry.getUri Bitmap bm MediaStore.Images.Thumbnails.getThumbnail mContext.getContentResolver selectedImageUri MediaStore.Images.Thumbnails.MICRO_KIND null Here anniEntry.getUri is the image uri.Now put it in second..
|