mediastore

when take photo get - java.lang.Throwable: file:// Uri exposed through ClipData.Item.getUri()

て烟熏妆下的殇ゞ 提交于 2019-11-27 20:06:00
The Exception is: file:// Uri exposed through ClipData.Item.getUri() java.lang.Throwable: file:// Uri exposed through ClipData.Item.getUri() at android.os.StrictMode.onFileUriExposed(StrictMode.java:1618) at android.net.Uri.checkFileUriExposed(Uri.java:2341) at android.content.ClipData.prepareToLeaveProcess(ClipData.java:808) at android.content.Intent.prepareToLeaveProcess(Intent.java:7926) at android.app.Instrumentation.execStartActivity(Instrumentation.java:1506) at android.app.Activity.startActivityForResult(Activity.java:3832) at android.app.Activity.startActivityForResult(Activity.java

Get cover picture by song

孤街浪徒 提交于 2019-11-27 15:51:11
Is it possible to get a cover picture by song and not by album. Because I have one self combined album with songs and they all have different cover pictures. But when I want to query them I always get the same picture returned. String[] ARG_STRING = {MediaStore.Audio.Media.ALBUM_ID}; ... String albumCover = _cursor.getString(_cursor.getColumnIndex(MediaStore.Audio.Media.ALBUM_ID)); ... MusicUtils.getArtwork(this, -1, Integer.parseInt(albumID)); So i would like to know how it's possible to get an cover image of an song. I know MusicUtils supports getArtwork by SongId, but what ID should I use

Why Images.Media.insertImage return null

扶醉桌前 提交于 2019-11-27 15:28:07
I have some code where I run the method MediaStore.Images.Media.insertImage (inserting it from a source not a file name), This code saves the image to the MediaStore and returns the uri of the image. I know that when it fails for any reason it will return null instead of a uri. This image has been downloaded multiple times by many people and every once in a while it will return null from this method. I have never had this happen to me so I have no idea what is going on. What are reasons why this could happen? There is another post with the same issue but the answer is a link to the source code

MediaStore.Images.Media.insertImage is returning null when trying to save the image

天涯浪子 提交于 2019-11-27 12:58:19
问题 I am using an custom view and in that i am using an canvas in which a user can draw anything and after that i want to save that image in sd card bt was not able to do that. Don't know what is going on. else if(view.getId()==R.id.save_btn){ //save drawing AlertDialog.Builder saveDialog = new AlertDialog.Builder(this); saveDialog.setTitle("Save drawing"); saveDialog.setMessage("Save drawing to device Gallery?"); saveDialog.setPositiveButton("Yes", new DialogInterface.OnClickListener(){ private

Android: Refreshing the Gallery after saving new images

雨燕双飞 提交于 2019-11-27 11:57:54
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.intent.action.MEDIA_MOUNTED from pid=2628, uid=10068 Could I be missing a permission in my

List all music in MediaStore with the PATHs

↘锁芯ラ 提交于 2019-11-27 11:14:35
Ok so I've been working on this project for a few days now and most of my time has been working out how to list all the music on a device in a LIST VIEW or something else, I have searched for a few days now and this is killing me. I did get so close at one point with all the music in one folder showing, though since most people will have sub folders for things like artiest and albums I need a way to search sub folders for MP3s or music files. Here is what I have so far for Music collection: package com.androidhive.musicplayer; import java.io.File; import java.io.FilenameFilter; import java

Tell the Camera Intent to save the taken image

柔情痞子 提交于 2019-11-27 08:08:23
问题 I'm doing this: intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); final File storage = Environment.getExternalStorageDirectory(); final Uri uri = Uri.fromFile(new File(storage, System.currentTimeMillis() + ".jpg")); intent.putExtra(MediaStore.EXTRA_OUTPUT, uri); startActivityForResult(intent, id); and to handle get that photo, I do this: private String getLastImagePath() { final String[] imageColumns = { MediaStore.Images.Media._ID, MediaStore.Images.Media.DATA }; final String

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

送分小仙女□ 提交于 2019-11-27 03:54:19
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 appreciated. Public class CameraTest extends Activity { /** Called when the activity is first created. *

Empty cursor from the MediaStore

假装没事ソ 提交于 2019-11-27 03:39:35
问题 I can't figure out why this cursor is empty in just this one particular device. but works on all other android devices. There are several audiofiles on the sdcard, and the stock mediaplayer can find and play these songs alright. Cursor c = managedQuery(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, new String[] { "distinct " + MediaStore.Audio.Media.ALBUM, MediaStore.Audio.Media.ARTIST, MediaStore.Audio.Media.ALBUM_KEY, MediaStore.Audio.Media.ALBUM_ID}, null, null, MediaStore.Audio.Media.ARTIST

Android cursor error - “make sure cursor is initialized correctly before accessing data from it…”

。_饼干妹妹 提交于 2019-11-27 02:45:24
问题 I've got an activity where a viewflipper shows a list containing the artists from mediastore, which onitem click display a list of albums by the chosen artist, which in turn displays the songs on that album. Once a song is clicked, it should populate a textview with the string 'title'. Until this point, all of the cursors are working fine, but the very last one seems to get put out of position somehow. Could anyone tell me why logcat is telling me: 05-07 23:58:54.195: E/AndroidRuntime(1961):