logo
down
shadow

What is the String 'volumeName' argument of MediaStore.Audio.Playlists.Members.getContentUri referring to?


What is the String 'volumeName' argument of MediaStore.Audio.Playlists.Members.getContentUri referring to?

By : user3864617
Date : January 10 2021, 01:47 PM
Any of those help The String "external" works as the volume in MediaStore.Audio.Playlists.Members.getContentUri(volume, playlistId)
This activity prints the songs on an Android, and the playlists, and their contents.
code :


Share : facebook icon twitter icon
Alternative to MediaStore.Playlists.Members.moveItem

Alternative to MediaStore.Playlists.Members.moveItem


By : yayapipi
Date : March 29 2020, 07:55 AM
wish helps you looking at the code of the MediaStore we came out with this solution that seems to work fine:
code :
/**
 * Convenience method to move a playlist item to a new location
 * @param res The content resolver to use
 * @param playlistId The numeric id of the playlist
 * @param from The position of the item to move
 * @param to The position to move the item to
 * @return true on success
 */
private boolean moveItem(ContentResolver res, long playlistId, int from, int to) {
    Uri uri = MediaStore.Audio.Playlists.Members.getContentUri("external",
            playlistId)
            .buildUpon()
            .appendEncodedPath(String.valueOf(from))
            .appendQueryParameter("move", "true")
            .build();
    ContentValues values = new ContentValues();
    values.put(MediaStore.Audio.Playlists.Members.PLAY_ORDER, to);
    return res.update(uri, values, null, null) != 0;
}
How to delete a playlist from MediaStore.Audio.Playlists in Android

How to delete a playlist from MediaStore.Audio.Playlists in Android


By : 孙福生
Date : March 29 2020, 07:55 AM
wish help you to fix your issue I use the following code to delete a specific playlist. All it needs is the playlist id of course
code :
private void deletePlaylist(String selectedplaylist) 
{
// // Log.i(TAG, "deletePlaylist");
String playlistid = getPlayListId(selectedplaylist);
ContentResolver resolver = this.getContentResolver();
String where = MediaStore.Audio.Playlists._ID + "=?";
String[] whereVal = {playlistid}; 
resolver.delete(MediaStore.Audio.Playlists.EXTERNAL_CONTENT_URI, where, whereVal);
Toast toast = Toast.makeText(this,selectedplaylist + " Deleted", Toast.LENGTH_SHORT);
    toast.show();   
return ;        
}
    public String getPlayListId(String playlist )

    {

    //  read this record and get playlistid

    Uri newuri =MediaStore.Audio.Playlists.EXTERNAL_CONTENT_URI;

    final String playlistid = MediaStore.Audio.Playlists._ID;

    final String playlistname = MediaStore.Audio.Playlists.NAME;

    String where = MediaStore.Audio.Playlists.NAME + "=?";

    String[] whereVal = {playlist}; 

    String[] projection = {playlistid, playlistname};

    ContentResolver resolver = getContentResolver();

    Cursor record = resolver.query(newuri , projection, where, whereVal, null);

    int recordcount = record.getCount();

    String foundplaylistid = "";

    if (recordcount > 0)

    {
    record.moveToFirst();

    int idColumn = record.getColumnIndex(playlistid);

    foundplaylistid = record.getString(idColumn);

    record.close();
    }

    return foundplaylistid;
    }
MediaMetadata to MediaStore.Audio.Media

MediaMetadata to MediaStore.Audio.Media


By : user3759435
Date : March 29 2020, 07:55 AM
fixed the issue. Will look into that further The trick was to search the title in the MediaStore.Audio.Media to get the song data:
code :
getContentResolver().query(MediaUri, new int[]{MediaStore.Audio.Media._ID, MediaStore.Audio.Media.TITLE,
                MediaStore.Audio.Media.ALBUM_ID, MediaStore.Audio.Media.ARTIST_ID},
                MediaStore.Audio.Media.TITLE + "=" + DatabaseUtils.sqlEscapeString(title), null, null)
How to get all the audio file using mediastore

How to get all the audio file using mediastore


By : Umair R Khan
Date : March 29 2020, 07:55 AM
Hope that helps I am trying to get all the media files from the device (Internal and SDcard).Till now I am able to get all the media files from a fixed folder of SD Card .I have gone through most of the web pages on mediastore .And i am able to get the media info.But how can I get all the audio files from the device any example will be helpful. I tried this way ` public class SongDto { , You can try this
code :
 ArrayList audio=new ArrayList();
 Cursor c=getContentResolver().query(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, new String[]{MediaStore.Audio.Media.DISPLAY_NAME}, null, null, null);


while(c.moveToNext())
 {
String name=c.getString(c.getColumnIndex(MediaStore.Audio.Media.DISPLAY_NAME));
audio.add(name);

 }
What does MediaStore.Images.Media.getContentUri(String volumeName):Uri do?

What does MediaStore.Images.Media.getContentUri(String volumeName):Uri do?


By : Debasish Sutradhar
Date : March 29 2020, 07:55 AM
Does that help I think the volume names are "external" and "internal" to refer to external (sdcard) and internal locations for the media. Each of the Media sub containers has this.
They also have static constant for the Internal and External URIs as well, which is probably preferred to use over the getContentUri(volumeName)
Related Posts Related Posts :
  • Is displayMetrix xdpi and ydpi accurate?
  • How to detect doubletap on a View?
  • how to play an encrypted file in Android
  • Android: keytool error on the command line when locating debug.keystore
  • Android paint/canvas issue; drawing smooth curves
  • Problems with starting an activity in onStart
  • Performance of map overlay in conjunction with ItemizedOverlay is very poor
  • How to change android indeterminate ProgressBar color?
  • How do I change the Mobile Country Code (MCC) in the Android Emulator?
  • Stop Progressbar manual scrolling in Android
  • Android: download large file
  • Android : uploaded .apk file to server but cant download that .apk file
  • How do I distribute Android app to beta tester without using Market
  • Android Unable to launch the Inbox from a notification
  • Android: Ringer mode changed to silent doesn't stop the phone vibrating
  • Change the side the text appears on a radio button
  • Check the memory usage anp cpu and power of an application in android
  • Playing Multiple sounds at the same time in Android
  • Android: how to change the time in emulator?
  • close the soft key pad when i click on other views in android
  • Setting the position within a spinner
  • How to play ringtone/alarm sound in Android
  • How to adjust text font size to fit textview
  • "Android 2.x" vs "Google APIs" for Android AVD Setup
  • How to center buttons on screen horizontally and vertically plus equidistant apart?
  • Discrete seekbar in Android app?
  • shadow
    Privacy Policy - Terms - Contact Us © 35dp-dentalpractice.co.uk