mediastore

MediaStore: get image data, thumbnail and folder

寵の児 提交于 2019-11-30 20:05:43
I have two lists. Let's call them AlbumsList and PicturesList. The first one shows photo album cover (one of the images from it) it's name and number of pictures in it. The second one shows all of the images contained in a chosen album. I've already done it using File class but it works too slow and finds all of the images on device when I need only those from gallery. I've read about MediaStore content provider but have never used it. So I have 2 questions: How to find "photo albums" (folders in gallery containing pictures), thumbnails for them and number of pictures in them using MediaStore

Getting efficiently the Genres of the Audio files in the MediaStore

你离开我真会死。 提交于 2019-11-30 19:47:30
问题 I am trying to synchronize my own database for tracks and albums (that contains additional data). I have so far successfully pulled albums and tracks from the MediaStore. What I cannot manage to do properly is to pull the Genres for the tracks. Could someone post some code? I'd like to avoid querying the database for each track, so if possible some code to load the association (Genre.id <-> Audio.id) would be great. What I am struggling on is using the content provider to get the Genres

how to get all all audio files from sd card android

▼魔方 西西 提交于 2019-11-30 14:32:32
问题 I want to write a class which gets all the mp3 files from the whole sd card. But actually it only gets the audio files laying directly on the sd card. so it doesnt search trough sub folders.I'd like to use Mediastore but i dont get it to an arraylist. Maybe you can help me, thanks a lot and sorry for beeing a noob ;) vinzenz import java.io.File; import java.io.FilenameFilter; import java.util.ArrayList; import java.util.HashMap; import de.me.musicplayer.SongsManager.FileExtensionFilter;

How to get list of video files in a specific folder in android?

谁都会走 提交于 2019-11-30 13:25:42
问题 How to get list of video files stored in a specific folder using mediastore? currently i'm using this code package com.example.videolisttest; import android.app.Activity; import android.content.Context; import android.database.Cursor; import android.os.Bundle; import android.provider.MediaStore; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.BaseAdapter; import android.widget.ListView; import android.widget.TextView; import

Accessing Videos AND Photos on Android 1.5 +

时光总嘲笑我的痴心妄想 提交于 2019-11-30 12:57:07
问题 So I'm trying to allow the user to pick a particular piece of media with my Android Application using the method described here: Access pictures from Pictures app in my android app It works great, except for the fact that I can seemingly only choose between either Video or Photo to present the user with, not both at the same time. Is there a good way to do this with: startActivityForResult(new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.INTERNAL_CONTENT_URI), SELECT

how to get all all audio files from sd card android

醉酒当歌 提交于 2019-11-30 10:46:51
I want to write a class which gets all the mp3 files from the whole sd card. But actually it only gets the audio files laying directly on the sd card. so it doesnt search trough sub folders.I'd like to use Mediastore but i dont get it to an arraylist. Maybe you can help me, thanks a lot and sorry for beeing a noob ;) vinzenz import java.io.File; import java.io.FilenameFilter; import java.util.ArrayList; import java.util.HashMap; import de.me.musicplayer.SongsManager.FileExtensionFilter; import android.database.Cursor; import android.net.Uri; import android.provider.MediaStore; public class

How to get list of video files in a specific folder in android?

℡╲_俬逩灬. 提交于 2019-11-30 10:17:35
How to get list of video files stored in a specific folder using mediastore? currently i'm using this code package com.example.videolisttest; import android.app.Activity; import android.content.Context; import android.database.Cursor; import android.os.Bundle; import android.provider.MediaStore; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.BaseAdapter; import android.widget.ListView; import android.widget.TextView; import android.widget.AdapterView.OnItemClickListener; import android.widget.Toast; public class MainActivity

How to query for songs in playlists on Android SDK?

荒凉一梦 提交于 2019-11-30 09:35:55
So my question is how to query for playlist content. I can make a query to display all the playlists, but how to make a query to display songs in a specific playlist. Thanks Okay, so I have manged to put the code together myself. So this is it : String[] proj = { MediaStore.Audio.Playlists.Members.AUDIO_ID, MediaStore.Audio.Playlists.Members.ARTIST, MediaStore.Audio.Playlists.Members.TITLE, MediaStore.Audio.Playlists.Members._ID }; c = getContentResolver().query( MediaStore.Audio.Playlists.Members.getContentUri("external",playlistID), proj, null, null, null); startManagingCursor(c); 来源: https:

MediaStore: get image data, thumbnail and folder

☆樱花仙子☆ 提交于 2019-11-30 05:03:01
问题 I have two lists. Let's call them AlbumsList and PicturesList. The first one shows photo album cover (one of the images from it) it's name and number of pictures in it. The second one shows all of the images contained in a chosen album. I've already done it using File class but it works too slow and finds all of the images on device when I need only those from gallery. I've read about MediaStore content provider but have never used it. So I have 2 questions: How to find "photo albums"

MediaStore.Images.Media.insertImage throwing permission denial on some devices

Deadly 提交于 2019-11-30 04:22:31
问题 I have problem with line of code: String path = MediaStore.Images.Media.insertImage(activity.getContentResolver(), bitmap, "feedback", null); Activity is not null, bitmap is not null. I get error: 0-22 11:23:59.644 29514-29527/? E/DatabaseUtils: Writing exception to parcel 10-22 11:23:59.644 29514-29527/? E/DatabaseUtils: java.lang.SecurityException: Permission Denial: writing com.android.providers.media.MediaProvider uri content://media/external/images/media from pid=1380, uid=10136 requires