Android: Set Ringtone for existing record in Mediastore.Audio.Media -


i able set ringtone perfectly, when insert row in mediastore.audio.media

 newuri = this.getcontentresolver().insert(mediastore.audio.media.getcontenturiforpath(k.getabsolutepath()), values);  

but existing record i.e when trying insert row again, logcat shows me database constraint error 19. how work around this? need set .ogg file sound board app ringtone, existing in mediastore database... appreciated..

i figured out. delete existing record in database before inserting.

uri uri = mediastore.audio.media.getcontenturiforpath(file.getabsolutepath()); getcontentresolver().delete(uri, mediastore.mediacolumns.data + "=\"" + file.getabsolutepath() + "\"", null); 

hope helps too.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -