mediastore

How to Save images to ImageView using Shared Preferences

眉间皱痕 提交于 2019-12-18 09:43:06
问题 I have an activity that opens another activity to get a download pic. The picture comes back to my original activity and rest in an imageView. That's working fine. How do I save the image so when the user comes back later, or kills to app the image is still there. I know I am supposed the use Shared Preferences to get the image path and not save the image itself but I just don't know how do that. Main Activity public class MainActivity extends Activity { private static final int REQUEST_CODE

How can I display a specific folder in Android Gallery3D (cooliris)?

本秂侑毒 提交于 2019-12-18 03:44:47
问题 I'm using Gallery3D (froyo-stable) I'm trying to make a little app that displays only images from a specific folder in a gallery view. Uri targetUri = Media.EXTERNAL_CONTENT_URI; String folderPath = Environment.getExternalStorageDirectory().toString() + "/DCIM/"; int folderBucketId = folderPath.toLowerCase().hashCode(); targetUri = targetUri.buildUpon().appendQueryParameter("bucketId", String.valueOf(folderBucketId)).build(); In initializeDataSource() // Creating the DataSource objects. final

Media Store not working when folder programmatically created

白昼怎懂夜的黑 提交于 2019-12-17 20:32:32
问题 I am accessing videos , from programmatically created folder, using following code But it returning cursor count 0 , what should I do to solve this problem. I have tested it on some devices, this is not perfect solution. looking for better one, can anyone help me? String selection=MediaStore.Video.Media.DATA +" like?"; String[] selectionArgs=new String[]{"%smartVcall%"}; videocursor = managedQuery(MediaStore.Video.Media.EXTERNAL_CONTENT_URI, parameters, selection, selectionArgs, MediaStore

How to use MediaStore query to get Artists without duplicates?

ぃ、小莉子 提交于 2019-12-17 20:27:50
问题 I would like to get all the artists names on my phone by using MediaStore ;Already I have the whole list but with duplicates of all entries due to multiple links songs/artists. Is there any way to use the query to get only one of each, without any duplicates? There is my query : String selection = MediaStore.Audio.Media.IS_MUSIC + " != 0"; String[] projection = { MediaStore.Audio.Media.ALBUM, MediaStore.Audio.Media.ARTIST, MediaStore.Audio.Media.TITLE, MediaStore.Audio.Media.DATA, MediaStore

Android: How to detect a change in MediaStore when connected over MTP

给你一囗甜甜゛ 提交于 2019-12-17 18:11:06
问题 I have big problems with MediaStore. I need to handle events when MediaStore is changed over MTP. I already have a receiver for android.intent.action.MEDIA_SCANNER_FINISHED action, but it is useful only for Universal Mass Storage(UMS). The scanner is not launched over MTP, because the MTP changes the MediaStore database directly. Please would you be so kind and help me how to detect this events. Thank you very much for any help! 回答1: I finally found a solution. I tried to use FileObserver but

Get Album Art With Album Name Android

◇◆丶佛笑我妖孽 提交于 2019-12-17 17:48:31
问题 I want to display album art with album name in listview. But i am not getting the way to display album art. I have tried from cover art on android. Here is my Code : Cursor cursor = managedQuery(MediaStore.Audio.Albums.EXTERNAL_CONTENT_URI, null, null, null, null); if (cursor == null) { //Query Failed , Handle error. } else if (!cursor.moveToFirst()) { //No media on the device. } else { int titleColumn = cursor.getColumnIndex(android.provider.MediaStore.Audio.Albums.ALBUM_ART); int id =

How to get and set (change) ID3 tag (metadata) of audio files?

一笑奈何 提交于 2019-12-17 17:33:34
问题 I am working to change ID3 tags, the metadata in audio files, such as: Artist Title Album etc. And the core point,. that edited ID3 tags should be shown only into my app. 回答1: I think this is what you are looking for MyID3 library to set and get tags for media file. Download this jar file MyID3_for_android and add it to your project's build path. here is the sample code. here pathdata is the file path of the audio file. File src = new File(pathdata); MusicMetadataSet src_set = null; try { src

Android: Refreshing the Gallery after saving new images

眉间皱痕 提交于 2019-12-17 10:34:23
问题 So in my application I at one point save a bunch of images to a temporary folder, and I want them to show up immediately in the Gallery. Off of a reboot, they do, but otherwise they don't. I've tried using the sendBroadcast method: sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED, Uri.parse("file://" + Environment.getExternalStorageDirectory()))); But I get a permission error: E/AndroidRuntime( 2628): java.lang.SecurityException: Permission Denial: not allowed to send broadcast android

MediaStore - Uri to query all types of files (media and non-media)

喜欢而已 提交于 2019-12-17 08:31:16
问题 In the class MediaStore.Files class, its mentioned that, Media provider table containing an index of all files in the media storage, including non-media files. I'm interested in querying for non-media files like PDF. I'm using CursorLoader to query the database. The second parameter for the constructor requires an Uri argument which is easy to get for the media types Audio, Images and Video as each of them have a EXTERNAL_CONTENT_URI and INTERNAL_CONTENT_URI constant defined for them. For

How do I save data from Camera to disk using MediaStore on Android?

喜欢而已 提交于 2019-12-17 07:22:10
问题 For my application, I'd been using my own Camera class for taking images and my own database but soon enough I couldn't really keep up with changes and I decided to use the built in camera application in Android to do the job, but I can't seem to get it to save file. What am I missing here? The application seems to save the file but it's just 0 bytes. I looked up the source code of the Camera application and it's looking for the "output" in Extras to save the file. Any help would be greatly