mediastore

Get all captured Videos in Android as a list

落花浮王杯 提交于 2019-12-23 01:55:07
问题 I am trying to get all video available in gallery with below code, String[] proj = { MediaStore.Video.Media._ID,MediaStore.Video.Media.DATA,MediaStore.Video.Media.DISPLAY_NAME,MediaStore.Video.Media.SIZE }; videocursor = managedQuery(MediaStore.Video.Media.EXTERNAL_CONTENT_URI,proj, null,null, null); int count = videocursor.getCount(); But I always get count = 0 , where was I made mistake ? I also tried Cursor videocursor = managedQuery(MediaStore.Video.Media.INTERNAL_CONTENT_URI, proj, null,

How to save image path using Shared Preferences

你说的曾经没有我的故事 提交于 2019-12-22 10:48:13
问题 I have an activity that opens another activity to get a camera gallery 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. Activity A private ImageView im1; private String selectedImagePath; private static final

Android MediaStore Insert Image Additional file created

不打扰是莪最后的温柔 提交于 2019-12-22 10:47:24
问题 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

Android Camera Intent - Out Of Memory Error and Rotation Error

五迷三道 提交于 2019-12-22 09:49:27
问题 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

Is there any way to look for an image using the path? MediaStore.Images.Thumbnails (Android)

老子叫甜甜 提交于 2019-12-21 21:27:54
问题 I'm using MediaStore.Images.Thumbnails in order to show the images the user have. But i'm not able to get an image through its path. Is there any way to look for an image using the path? String [] proj={MediaStore.Images.Thumbnails._ID, MediaStore.Images.Thumbnails.IMAGE_ID, MediaStore.Images.Media.DATA}; String selection = MediaStore.Images.Media.DATA + " like '%path%'"; //this doesn't work cursor = managedQuery( MediaStore.Images.Thumbnails.EXTERNAL_CONTENT_URI, proj, // Which columns to

How to refresh Android's MediaStore upon photo deletion

耗尽温柔 提交于 2019-12-21 13:43:21
问题 Question: how to make the media store to refresh its entry of a DELETED file? After deleting a photo in code from the external storage, I still see a slot for the deleted photo in the gallery - blank photo. It seems that the gallery reflects the media store and the deleted photo is found in the media store until the phone is restarted or generally - until the media is rescanned. Trying to scan the deleted file did not help scanning deleted files (works just for new or existing files):

Querying the MediaStore: Joining thumbnails and images (on ID)

眉间皱痕 提交于 2019-12-21 04:35:11
问题 I'm working on a "photo gallery"-type app for Android. It started as a Final Project for the Developing Android Apps at Udacity, so it's overall structure (activities, contentproviders etc) should be very sound, and it was accepted for certification by Udacity/Google. However, it's still not 100% finished, and I'm still trying to improve on it. What I want to do should really be quite straight-forward; load all images on device (as thumbnails) into a GridView in the MainActivity, with a

Loading large number of items in recycler view

心已入冬 提交于 2019-12-20 20:19:32
问题 I have a recycler view within a fragment and basically I m trying to load song list in the recycler view .Each row of recycler view contains an imageview (for album art) and textview ( for song name). I am having trouble when the size of the dataset is huge, that is when there are too many songs, the recycler view lags and the app ends up giving an ANR.I am using Glide to load album arts in each row's imageview. How is google music player able to show such large number of songs without any

Uri.parse(“file://” + ???); to access specific folder

笑着哭i 提交于 2019-12-20 06:45:12
问题 My question is two part, how can I get the following code to access this location: "/storage/emulated/0/Movies/SpecificFolder" Code: private Uri getUriFromMediaStore(int position) { int dataIndex = mMediaStoreCursor.getColumnIndex(MediaStore.Files.FileColumns.DATA); mMediaStoreCursor.moveToPosition(position); String dataString = mMediaStoreCursor.getString(dataIndex); Uri mediaUri = Uri.parse("file://" + dataString); return mediaUri; } and, when the time comes how can I access videos/files

How can I specify the output file's folder when calling RECORD_SOUND_ACTION?

大憨熊 提交于 2019-12-20 05:10:14
问题 I'd like to specify a destination folder when I call the MediaStore built-in sound recorder app, e.g. the sdcard folder. According to the Android documentation, there is no support for EXTRA_OUTPUT when calling the RECORD_SOUND_ACTION . How can I do this? 回答1: You will have to allow the file to be recorded using whatever default filename and location are used and then move the file. Moving the file is far from trivial. Here's a complete example. import java.io.File; import java.io.IOException