android-contentresolver

Android: Accessing and querying properly using Raw Contact Id

So my app is attempting to integrate a sync adapter to the android native contact manager. This is all running smoothly except once a contact is synced, I am unable to update it. Details on this particular problem can be found here: Android: Content resolver query returning 0 rows when it ought not...

Trying to read SMS/MMS on Android and geting java.lang.NullPointerException

I'm trying to read SMS/MMS on Android, and I have followed the answer , when writing the code and try to run it on an Android OS 6.0.1 on Samsung device I got the following exception: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)'...

Android MediaStore get cursor position by comparing with TITLE_KEY

I am using MediaStore's media content and have a SearchView to filter the content displayed in a listfragment. I keep a reference to the cursor( mainCursor ) when the query string is null (which means all rows) When user searches, i get new cursor based on the query As per my understanding(I am very...

Android getting file path from content URI using contentResolver

I'm trying to get the file path for a content URI. URL looks like this: content://com.android.providers.downloads.documents/document/31 The cursor object is not null but the cursor.getString(column_index) returns null. Column index is always 0. public static String getPath(Context context, Uri uri)...

How can I get MediaMetaData like Album, Track, Titel, Albumart, etc. from MediaStore in Android 10

I struggled for a long time to fetch album, track, duration, album art from audiofiles using Android 10 mediaStore . What I did so far: Open an Intent an fetch the Audio-Folder: Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT_TREE); intent.addCategory(Intent.CATEGORY_DEFAULT); intent.addFlags...

Getting null value while retrieving the CONTACT NAME from CONTACT EMAIL

I want to retrieve the contact name from the contact email, so what I have done is as follows from https://stackoverflow.com/a/18064869/5738881 . public static String readContacts(Context context, String email) { ContentResolver cr = context.getContentResolver(); Uri uri = Uri.withAppendedPath...