Can anybody translate this to B4A ?, PLEASE
I'm trying to set a ringtone for a specific contact(s).
Thank you:
====================================
Uri contactData = ContactsContract.Contacts.CONTENT_URI;
String contactId = contactData.getLastPathSegment();
Cursor localCursor = managedQuery(contactData, PROJECTION, null, null, null);
localCursor.move(120/*CONTACT ID NUMBER*/);
String str1 = localCursor.getString(localCursor.getColumnIndexOrThrow("_id"));
String str2 = localCursor.getString(localCursor.getColumnIndexOrThrow("display_name"));
Uri localUri = Uri.withAppendedPath(ContactsContract.Contacts.CONTENT_URI, str1);
ContentValues localContentValues = new ContentValues();
localContentValues.put(ContactsContract.Data.RAW_CONTACT_ID, contactId);
localContentValues.put(ContactsContract.Data.CUSTOM_RINGTONE, f.getAbsolutePath()+"/Adventure.ogg");
getContentResolver().update(localUri, localContentValues, null, null);
Toast.makeText(this, "Ringtone assigned to: " + str2, 0).show();
From:
"http://stackoverflow.com/questions/14230444/setting-contact-custom-ringtone-how"
I'm trying to set a ringtone for a specific contact(s).
Thank you:
====================================
Uri contactData = ContactsContract.Contacts.CONTENT_URI;
String contactId = contactData.getLastPathSegment();
Cursor localCursor = managedQuery(contactData, PROJECTION, null, null, null);
localCursor.move(120/*CONTACT ID NUMBER*/);
String str1 = localCursor.getString(localCursor.getColumnIndexOrThrow("_id"));
String str2 = localCursor.getString(localCursor.getColumnIndexOrThrow("display_name"));
Uri localUri = Uri.withAppendedPath(ContactsContract.Contacts.CONTENT_URI, str1);
ContentValues localContentValues = new ContentValues();
localContentValues.put(ContactsContract.Data.RAW_CONTACT_ID, contactId);
localContentValues.put(ContactsContract.Data.CUSTOM_RINGTONE, f.getAbsolutePath()+"/Adventure.ogg");
getContentResolver().update(localUri, localContentValues, null, null);
Toast.makeText(this, "Ringtone assigned to: " + str2, 0).show();
From:
"http://stackoverflow.com/questions/14230444/setting-contact-custom-ringtone-how"