mediastore

Android MediaStore insertVideo

為{幸葍}努か 提交于 2019-11-27 02:24:37
问题 So our app has the option to take either a picture or a video. If the user takes a picture, we can use the MediaStore.Images.Media.insertImage function to add the new image (via a filepath) to the phone's gallery and generate a content:// style URI. Is there a similar process for a captured video, given that we only have it's filepath? 回答1: Here is an easy 'single file based solution': Whenever you add a file, let MediaStore Content Provider knows about it using sendBroadcast(new Intent

Android: Picasso load image failed . how to show error message

只愿长相守 提交于 2019-11-27 00:50:32
I am trying to use the picasso library to loading the image store in the mediastore. When I called load(imageview, callback), the picasso call onFail instead of onSuccess. How do I know why the image was not loaded successfully? Use builder: Picasso.Builder builder = new Picasso.Builder(this); builder.listener(new Picasso.Listener() { @Override public void onImageLoadFailed(Picasso picasso, Uri uri, Exception exception) { exception.printStackTrace(); } }); builder.build().load(URL).into(imageView); Edit For version 2.71828 they have added the exception to the onError callback: Picasso.get()

Setting Ringtone notification from SD card file

孤者浪人 提交于 2019-11-26 23:25:52
问题 My goal is to set the users notification sound from a file that is stored onto the SD card from with in the application. I am using this code: if(path != null){ File k = new File(path, "moment.mp3"); ContentValues values = new ContentValues(); values.put(MediaStore.MediaColumns.DATA, k.getAbsolutePath()); values.put(MediaStore.MediaColumns.TITLE, "My Song title"); values.put(MediaStore.MediaColumns.SIZE, 215454); values.put(MediaStore.MediaColumns.MIME_TYPE, "audio/mp3"); values.put

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

风流意气都作罢 提交于 2019-11-26 22:53:19
问题 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

Why Images.Media.insertImage return null

大城市里の小女人 提交于 2019-11-26 18:32:06
问题 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

List all camera images in Android

£可爱£侵袭症+ 提交于 2019-11-26 17:27:08
How do you get a list of all camera images of an Android device? Is it through the MediaStore? How? The Gallery app obtains camera images by using a content resolver over Images.Media.EXTERNAL_CONTENT_URI and filtering the results by Media.BUCKET_ID . The bucket identifier is determined with the following code: public static final String CAMERA_IMAGE_BUCKET_NAME = Environment.getExternalStorageDirectory().toString() + "/DCIM/Camera"; public static final String CAMERA_IMAGE_BUCKET_ID = getBucketId(CAMERA_IMAGE_BUCKET_NAME); /** * Matches code in MediaProvider.computeBucketValues. Should be a

Get cover picture by song

跟風遠走 提交于 2019-11-26 17:21:19
问题 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

List all music in MediaStore with the PATHs

邮差的信 提交于 2019-11-26 15:28:18
问题 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:

Android: Picasso load image failed . how to show error message

风流意气都作罢 提交于 2019-11-26 09:28:34
问题 I am trying to use the picasso library to loading the image store in the mediastore. When I called load(imageview, callback), the picasso call onFail instead of onSuccess. How do I know why the image was not loaded successfully? 回答1: Use builder: Picasso.Builder builder = new Picasso.Builder(this); builder.listener(new Picasso.Listener() { @Override public void onImageLoadFailed(Picasso picasso, Uri uri, Exception exception) { exception.printStackTrace(); } }); builder.build().load(URL).into

Get filename and path from URI from mediastore

白昼怎懂夜的黑 提交于 2019-11-26 08:50:11
问题 I have an onActivityResult returning from an mediastore image selection which I can get a URI for an image using the following: Uri selectedImage = data.getData(); Converting this to a string gives this: content://media/external/images/media/47 Or to a path gives: /external/images/media/47 However I can\'t seem to find a way to convert this into an absolute path, as I want to load the image into a bitmap without having to copy it somewhere. I know this can be done using the URI and content