mediastore

What is the best way for pick a video in Android

。_饼干妹妹 提交于 2019-12-07 01:45:21
问题 I got a perfect Intent.ACTION_PICK with my picture. startActivityForResult(new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.INTERNAL_CONTENT_URI), SELECT_IMAGE); But it doesn't work with video. When i click on a video of my list, it play the vidoe instead of send me back. startActivityForResult(new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Video.Media.INTERNAL_CONTENT_URI), SELECT_VIDEO); An idea ? 回答1: You want to use Intent.ACTION_GET_CONTENT and specify

Playing audio from MediaStore on a Media Player Android

廉价感情. 提交于 2019-12-06 09:00:39
问题 Is there a way to play audio obtained from MediaStore through the use of the MediaPLayer, Or am I going in the completely wrong direction? I've looked and MediaStore.Audio so far but nothing is really helping me. I just need to know if I'm on the right track 回答1: First, I assume you have basic knowledge of querying a ContentProvider and working with Cursors. If you dont, I suggest you research it here Once you have a basic knowledge of how to use a ContentProvider, query the URI MediaStore

how to view image through image id in android

我只是一个虾纸丫 提交于 2019-12-06 08:09:43
I've got the image id in the MediaStore. How can I view the image in the gallery with the id? I currently use the following code: ContentResolver cr = context.getContentResolver(); String columns[] = new String[]{ Media._ID, Media.DATA }; Cursor cursor = cr.query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, columns, Media._ID+"=?", new String[]{id+""}, null); if(cursor.moveToNext()) { String imagePath = cursor.getString(cursor.getColumnIndex(Media.DATA)); Uri imageUri = Uri.fromFile(new File(imagePath)); Intent intent = new Intent(); intent.setAction(android.content.Intent.ACTION_VIEW);

Android get song from Media Store if you have the song ID?

为君一笑 提交于 2019-12-06 07:41:58
I got a song id from a playlist in MediaStore, using long id = cursor.getLong(cursor.getColumnIndex(MediaStore.Audio.Playlists.Members.AUDIO_ID)); and the id is correct, but as the only other data available is CONTENT_DIRECTORY, DEFAULT_SORT_ORDER, PLAYLIST_ID, PLAY_ORDER, and _ID, I am not sure how to get the important parts of the song. I need the title, album, artist, etc., as if I was going through MediaStore.Audio.Media to get Song info. I found an answer that I tried to modify to fit my needs, but I don't really understand querying or cursors, I am not sure how if there is a way to get a

Limitations of android

早过忘川 提交于 2019-12-06 07:18:42
I need to build an app that takes a camera image and uploads it to the web where some processing is to be done and a true/false is returned. I encounter some questions in this respect on which a clarification would be well appreciated. 1.) Is there any way my app can know image being captured by the android camera? What I understood from here ( Android: BroadcastReceiver intent to Detect Camera Photo Taken? ) is that we can know whenever a picture has been added to the phone,be it via Bluetooth or through a camera capture or otherwise. Any way that is just fine. The question is doesn't that

Android Camera Intent - Out Of Memory Error and Rotation Error

梦想与她 提交于 2019-12-06 03:14:30
I'm creating an android app that utilizes the camera to take pictures and then sends them to a server based on user input. I'm currently having some problems with the camera intent. My main problems are : Getting a picture that seems to be rotated when compared to the position it was taken. When I try to fix this Rotation I get an OutOfMemoryError So mainly I need to make sure that the orientation of the picture doesn't change and that I don't get an OutOfMemoryError. Here is the function that uses the camera Intent to take the picture. private void dispatchTakePictureIntent(int actionCode) {

Android MediaStore Insert Image Additional file created

◇◆丶佛笑我妖孽 提交于 2019-12-05 21:18:00
I am inserting an Image in the MediaStore cache using the following code snippet: MediaStore.Images.Media.insertImage(getContentResolver(), selectedFile.getParent() + file.separator + selectedFile.getName(), selectedFile.getName(),null); The insertion is ok but it also creates another image thumbnail at the same path. This is not visible in the gallery but when browsed using file browser this image thumbnail is visible. How can I stop this image thumbnail to be created here so as not to confuse the user. Mircea Nistor The documentation for MediaStore.Images.Media.insertImage() says that it:

Play song on default music player - android

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-05 20:50:16
问题 My app show list of song from sd card. I want to be able to play the song on the default player. I've got all the data about the song: id, title, album, artist, path... Is there a way to launch the default player to play the song? What I've tried: Using Intent.CATEGORY_APP_MUSIC . I can launch the default player, but can't set the song. Intent.makeMainSelectorActivity(Intent.ACTION_MAIN, Intent.CATEGORY_APP_MUSIC) open the default music app. However intent.setData(Uri.withAppendedPath

How to update genre in mediastore?

那年仲夏 提交于 2019-12-05 07:45:32
I'm trying to update the genre tag of an audio file. CODE final Uri genreUri = MediaStore.Audio.Genres.EXTERNAL_CONTENT_URI; String currentGenreName = MediaStore.Audio.Genres.NAME; ContentValues values2 = new ContentValues(); values2.put(currentGenreName, genre); String whereGenre = MediaStore.Audio.Genres._ID + "=?"; String[] whereVal2 = {Long.toString(genreID)}; resolver.update(genreUri, values2, whereGenre, whereVal2); genre : value from edittext (new genre name). genreID : genreID from selected audio file. I'm not getting any errors, but the genre doesn't update in the MediaStore genre

Android - Image picker doesn't work on Kindle Fire?

。_饼干妹妹 提交于 2019-12-05 07:22:07
I have the following code to display an imagepicker. After user picks an image onActivityResult gets called, to return me the data for the selected image. On kindle however, I get a resultCode of 0, and data as null. Anyone else has noticed this problem before? This problem happens only on kindle fire. startActivityForResult(new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.INTERNAL_CONTENT_URI), SELECT_PICTURE); I'm running into this exact same issue. Prior to the recent Kindle Fire update, which happened a few days ago for me, picking images from the gallery worked fine