How to update album art with new image in mediastore using contentproviders in android -


i want update audio file new album art image tried below code updating album art when open audio file in music player displaying original image again here image path coming below intent please give idea solve

            intent = new intent();             i.settype("image/*");             i.setaction(intent.action_get_content);             startactivityforresult(i, image_path_id);   if (imgpath != null && !imgpath.endswith(".mp3")) {                 uri sartworkuri = uri.parse(mediastore.audio.albums.album_art);                 if (albumid != null) {                     int numdeleted = getcontext().getcontentresolver().delete(contenturis.withappendedid(sartworkuri, albumid), null, null);                     log.d("", "deleted image status" + numdeleted);                 }                  contentvalues values = new contentvalues();                 values.put("album_id", albumid);                 values.put("_data", imgpath);                 uri num_updates = getcontext().getcontentresolver().insert(sartworkuri, values);                 log.d("", "updated albumart row " + num_updates);                 getcontext().getcontentresolver().notifychange(sartworkuri, null);                 intent scanintent = new intent(intent.action_media_scanner_scan_file);                 scanintent.setdata(num_updates);                 getcontext().sendbroadcast(scanintent);             } 


Comments

Popular posts from this blog

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

minify - Minimizing css files -

php - How to remove letter in front of the word laravel -