android Programming Glossary: context.getcontentresolver
how to listen for changes in Contact Database http://stackoverflow.com/questions/1401280/how-to-listen-for-changes-in-contact-database MyContentObserver contentObserver new MyContentObserver context.getContentResolver .registerContentObserver People.CONTENT_URI true contentObserver..
Observing changes in android content observer for Audio.Media.EXTERNAL_CONTENT_URI http://stackoverflow.com/questions/15899110/observing-changes-in-android-content-observer-for-audio-media-external-content-u for its latest changes the it could help but mCursor context.getContentResolver .query Audio.Media.EXTERNAL_CONTENT_URI null null null _id..
cover art on android http://stackoverflow.com/questions/1954434/cover-art-on-android sArtworkUri album_id ContentResolver res context.getContentResolver InputStream in res.openInputStream uri Bitmap artwork BitmapFactory.decodeStream..
How to use SMS content provider? Where are the docs? http://stackoverflow.com/questions/1976252/how-to-use-sms-content-provider-where-are-the-docs like this Uri uriSms Uri.parse content sms inbox Cursor c context.getContentResolver .query uriSms null null null null column names for above provider..
How to look-up a contact's name from their phone number on Android? http://stackoverflow.com/questions/2174048/how-to-look-up-a-contacts-name-from-their-phone-number-on-android new String PhoneLookup.DISPLAY_NAME ... Cursor cursor context.getContentResolver .query uri projection ... UPDATE The format of the phone number..
Delete SMS in Android 1.5 http://stackoverflow.com/questions/2183680/delete-sms-in-android-1-5 suitable I have used was the following but it doesn't work context.getContentResolver .delete deleteUri address and date new String msg.getOriginatingAddress.. Uri deleteUri Uri.parse content sms int count 0 Cursor c context.getContentResolver .query deleteUri null null null null while c.moveToNext try.. pid c.getString 0 Get id String uri content sms pid count context.getContentResolver .delete Uri.parse uri null null catch Exception e return count..
How do I load a contact Photo? http://stackoverflow.com/questions/2383580/how-do-i-load-a-contact-photo badge this.phoneNumber phoneNumber contentResolver context.getContentResolver public void addThumbnail final Integer thumbnailId fetchThumbnailId..
Detecting SMS incoming and outgoing http://stackoverflow.com/questions/2735571/detecting-sms-incoming-and-outgoing msg26420.html ContentResolver contentResolver context.getContentResolver contentResolver.registerContentObserver Uri.parse content sms..
How to set the AIRPLANE_MODE_ON to “True” or ON? http://stackoverflow.com/questions/3249245/how-to-set-the-airplane-mode-on-to-true-or-on upto API 16 Toggle airplane mode. Settings.System.putInt context.getContentResolver Settings.System.AIRPLANE_MODE_ON isEnabled 0 1 Post an intent..
Retrieve Contact Phone Number From URI in Android http://stackoverflow.com/questions/3370628/retrieve-contact-phone-number-from-uri-in-android type Log.d TAG String.valueOf contactId Cursor cursor context.getContentResolver .query ContactsContract.CommonDataKinds.Phone.CONTENT_URI null..
Get filename and path from uri from mediastore http://stackoverflow.com/questions/3401579/get-filename-and-path-from-uri-from-mediastore null try String proj MediaStore.Images.Media.DATA cursor context.getContentResolver .query contentUri proj null null null int column_index cursor.getColumnIndexOrThrow..
How can one detect airplane mode on Android? http://stackoverflow.com/questions/4319212/how-can-one-detect-airplane-mode-on-android Context context return Settings.System.getInt context.getContentResolver Settings.System.AIRPLANE_MODE_ON 0 0 share improve this answer..
How to remove a contact programmatically in android http://stackoverflow.com/questions/527216/how-to-remove-a-contact-programmatically-in-android private void removeContact Context context String phone context.getContentResolver .delete Contacts.Phones.CONTENT_URI phone null context.getContentResolver.. .delete Contacts.Phones.CONTENT_URI phone null context.getContentResolver .delete Contacts.Phones.CONTENT_URI Contacts.PhonesColumns.NUMBER..
Toggle airplane mode in Android http://stackoverflow.com/questions/5533881/toggle-airplane-mode-in-android 0 1 Settings.System.putInt context.getContentResolver Settings.System.AIRPLANE_MODE_ON isEnabled 0 1 Settings.System.putInt..
Listen to outgoing SMS or sent box http://stackoverflow.com/questions/5808577/listen-to-outgoing-sms-or-sent-box something like this ContentResolver contentResolver context.getContentResolver contentResolver.registerContentObserver Uri.parse content sms..
Android file chooser [closed] http://stackoverflow.com/questions/7856959/android-file-chooser String projection _data Cursor cursor null try cursor context.getContentResolver .query uri projection null null null int column_index cursor.getColumnIndexOrThrow..
How can I read SMS messages from the inbox programmatically in Android? http://stackoverflow.com/questions/848728/how-can-i-read-sms-messages-from-the-inbox-programmatically-in-android AND thread_id ignoreThreadId Cursor cursor context.getContentResolver .query SMS_INBOX_CONTENT_URI new String _id thread_id address..
how to listen for changes in Contact Database http://stackoverflow.com/questions/1401280/how-to-listen-for-changes-in-contact-database super.onChange selfChange System.out.println Calling onChange MyContentObserver contentObserver new MyContentObserver context.getContentResolver .registerContentObserver People.CONTENT_URI true contentObserver But When I use 'EditContactActivity' to change the contact..
Observing changes in android content observer for Audio.Media.EXTERNAL_CONTENT_URI http://stackoverflow.com/questions/15899110/observing-changes-in-android-content-observer-for-audio-media-external-content-u Knows methods for querying Audio.Media.EXTERNAL_CONTENT_URI for its latest changes the it could help but mCursor context.getContentResolver .query Audio.Media.EXTERNAL_CONTENT_URI null null null _id mCursor.moveToLast doesnt give the latest changes So any other..
cover art on android http://stackoverflow.com/questions/1954434/cover-art-on-android content media external audio albumart Uri uri ContentUris.withAppendedId sArtworkUri album_id ContentResolver res context.getContentResolver InputStream in res.openInputStream uri Bitmap artwork BitmapFactory.decodeStream in More complete sample code can be found..
How to use SMS content provider? Where are the docs? http://stackoverflow.com/questions/1976252/how-to-use-sms-content-provider-where-are-the-docs I just dumped all the column names in that provider looks like this Uri uriSms Uri.parse content sms inbox Cursor c context.getContentResolver .query uriSms null null null null column names for above provider 0 _id 1 thread_id 2 address 3 person 4 date 5 protocol..
How to look-up a contact's name from their phone number on Android? http://stackoverflow.com/questions/2174048/how-to-look-up-a-contacts-name-from-their-phone-number-on-android Uri.encode phoneNumber Query the filter URI String projection new String PhoneLookup.DISPLAY_NAME ... Cursor cursor context.getContentResolver .query uri projection ... UPDATE The format of the phone number does not matter. Comparison is robust and highly optimized..
Delete SMS in Android 1.5 http://stackoverflow.com/questions/2183680/delete-sms-in-android-1-5 must be removed programmatically. How can I do it The most suitable I have used was the following but it doesn't work context.getContentResolver .delete deleteUri address and date new String msg.getOriginatingAddress String.valueOf msg.getTimestampMillis java.. private int deleteMessage Context context SmsMessage msg Uri deleteUri Uri.parse content sms int count 0 Cursor c context.getContentResolver .query deleteUri null null null null while c.moveToNext try Delete the SMS String pid c.getString 0 Get id String uri content.. null null null while c.moveToNext try Delete the SMS String pid c.getString 0 Get id String uri content sms pid count context.getContentResolver .delete Uri.parse uri null null catch Exception e return count Thanks everyone for help ps if this code is useful for..
How do I load a contact Photo? http://stackoverflow.com/questions/2383580/how-do-i-load-a-contact-photo final QuickContactBadge badge final String phoneNumber this.badge badge this.phoneNumber phoneNumber contentResolver context.getContentResolver public void addThumbnail final Integer thumbnailId fetchThumbnailId if thumbnailId null final Bitmap thumbnail fetchThumbnail..
Detecting SMS incoming and outgoing http://stackoverflow.com/questions/2735571/detecting-sms-incoming-and-outgoing
How to set the AIRPLANE_MODE_ON to “True” or ON? http://stackoverflow.com/questions/3249245/how-to-set-the-airplane-mode-on-to-true-or-on the blog article Android Controlling Airplane Mode Works only upto API 16 Toggle airplane mode. Settings.System.putInt context.getContentResolver Settings.System.AIRPLANE_MODE_ON isEnabled 0 1 Post an intent to reload. Intent intent new Intent Intent.ACTION_AIRPLANE_MODE_CHANGED..
Retrieve Contact Phone Number From URI in Android http://stackoverflow.com/questions/3370628/retrieve-contact-phone-number-from-uri-in-android whereArgs new String String.valueOf contactId String.valueOf type Log.d TAG String.valueOf contactId Cursor cursor context.getContentResolver .query ContactsContract.CommonDataKinds.Phone.CONTENT_URI null ContactsContract.CommonDataKinds.Phone.CONTACT_ID and ContactsContract.CommonDataKinds.Phone.TYPE..
Get filename and path from uri from mediastore http://stackoverflow.com/questions/3401579/get-filename-and-path-from-uri-from-mediastore Context context Uri contentUri Cursor cursor null try String proj MediaStore.Images.Media.DATA cursor context.getContentResolver .query contentUri proj null null null int column_index cursor.getColumnIndexOrThrow MediaStore.Images.Media.DATA cursor.moveToFirst..
How can one detect airplane mode on Android? http://stackoverflow.com/questions/4319212/how-can-one-detect-airplane-mode-on-android
How to remove a contact programmatically in android http://stackoverflow.com/questions/527216/how-to-remove-a-contact-programmatically-in-android the following code to remove contact with a specified number private void removeContact Context context String phone context.getContentResolver .delete Contacts.Phones.CONTENT_URI phone null context.getContentResolver .delete Contacts.Phones.CONTENT_URI Contacts.PhonesColumns.NUMBER.. removeContact Context context String phone context.getContentResolver .delete Contacts.Phones.CONTENT_URI phone null context.getContentResolver .delete Contacts.Phones.CONTENT_URI Contacts.PhonesColumns.NUMBER new String phone But I get this exception java.lang.UnsupportedOperationException..
Toggle airplane mode in Android http://stackoverflow.com/questions/5533881/toggle-airplane-mode-in-android this.getApplicationContext .getContentResolver Settings.System.AIRPLANE_MODE_ON 0 1 Settings.System.putInt context.getContentResolver Settings.System.AIRPLANE_MODE_ON isEnabled 0 1 Settings.System.putInt this.getApplicationContext .getContentResolver Settings.System.AIRPLANE_MODE_ON..
Listen to outgoing SMS or sent box http://stackoverflow.com/questions/5808577/listen-to-outgoing-sms-or-sent-box question Basically you have to register a content observer... something like this ContentResolver contentResolver context.getContentResolver contentResolver.registerContentObserver Uri.parse content sms out true yourObserver yourObserver is an object new YourObserver..
Android file chooser [closed] http://stackoverflow.com/questions/7856959/android-file-chooser URISyntaxException if content .equalsIgnoreCase uri.getScheme String projection _data Cursor cursor null try cursor context.getContentResolver .query uri projection null null null int column_index cursor.getColumnIndexOrThrow _data if cursor.moveToFirst return..
How can I read SMS messages from the inbox programmatically in Android? http://stackoverflow.com/questions/848728/how-can-i-read-sms-messages-from-the-inbox-programmatically-in-android 0 Log.v Ignoring sms threadId ignoreThreadId WHERE_CONDITION AND thread_id ignoreThreadId Cursor cursor context.getContentResolver .query SMS_INBOX_CONTENT_URI new String _id thread_id address person date body WHERE_CONDITION null SORT_ORDER..
|