mediastore

Change Camera settings from another App's Activity

天大地大妈咪最大 提交于 2019-12-25 05:32:39
问题 I have an Android app that calls the native camera app to take a picture and returns the image for further manipulation. My problem, is that I run into memory leaks if the camera is set to 2(+) megapixels. Ideally, I want it set to the lowest (VGA) since image quality is not a concern with this app. Is there a way from my app to change the settings of the native device's camera app? Here is the code I am using: Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); mImageCaptureUri =

How to Use MediaStore to display all images in GridView

狂风中的少年 提交于 2019-12-25 02:21:13
问题 I need a little help in trying to figure out a problem that I am having. I have an application that will query all the images on the phone and display them in a GridView. I was able to do this and populate the list. The problem is when I am accessing the list and getting information from the items from a query. The cursor is telling me that the item has a file path of /mnt/sdcard/images/media/file.jpg but the path is only /sdcard/images/media/file.jpg This is the code I used to populate the

Sort results from an Android sdk Cursor's managedQuery in a case insensitive manner

て烟熏妆下的殇ゞ 提交于 2019-12-24 22:14:57
问题 I'm using the string 'MediaStore.Audio.Media.TITLE + " ASC"' to sort the resultant list of a managedQuery in an Android Cursor but, unfortunately, my items that begin with 'a' appear after the items that begin with 'Z'... I would like to know how to perform a managedQuery with the resultant list sorted in a case-insensitive fashion. Help? 回答1: A quick google search turns up this post which almost directly answers your question. But since I'm assuming you'll want to retain the case of the

No “number_of_albums column” in MediaStore.Audio.Artists

我的梦境 提交于 2019-12-24 17:00:58
问题 I want to retrieve data from MediaStore especially the number of albums per artist but SQLite throws me an exception no such column: number_of_albums (code 1): while compiling: SELECT artist_key, artist, number_of_albums FROM audio WHERE (is_music != 0) Can someone explain me what I am doing wrong? My code : private List<Artist> getArtistList() { String selection = MediaStore.Audio.Media.IS_MUSIC + " != 0"; String[] projection = { MediaStore.Audio.Artists.ARTIST_KEY, MediaStore.Audio.Artists

Android - Is MediaStore ID a safe way to store information about pics/albums?

吃可爱长大的小学妹 提交于 2019-12-24 16:32:25
问题 In my app I store information about an image or an image album by storing it's MediaStore id. Later on I may have to perform operations that require these images/albums. Is the MediaStore id a safe way to keep image\album information? More specifically: 1) If an image/album whose id I have stored gets deleted, is it possible a new picture/album could take this id resulting in me using the wrong picture/album ? 2) when pictures/abums are renamed or moved ( using a file browser on the phone or

Android - intent to record video on lowest quality

馋奶兔 提交于 2019-12-24 14:21:12
问题 I have a project where the user can take pictures and videos without limitation of time, so i need to record with the lowest quality. This is my code: Intent takeVideoIntent = new Intent(android.provider.MediaStore.ACTION_VIDEO_CAPTURE); takeVideoIntent.putExtra(android.provider.MediaStore.EXTRA_VIDEO_QUALITY, 0); if (takeVideoIntent.resolveActivity(getPackageManager()) != null) { startActivityForResult(takeVideoIntent, REQUEST_VIDEO_CAPTURE); } in (MediaStore.EXTRA_VIDEO_QUALITY, 0);) i made

Android- How do i get the URI of the latest file saved by the system?

浪子不回头ぞ 提交于 2019-12-24 10:58:50
问题 In android, how could I get the URI last file saved to the system? I need this ability for an image editting application. As far as I can tell ContentObserver can only check if something has changed and neither MediaStore.Images.Media or MediaStore.Files have a method I could use. Any help would be greatly appreciated. 回答1: You could iterate trough the files in the folder(s) your application is targeting and get the newest file trough the lastModified() method then you could get it's location

Cannot remove an image inserted with MediaStore

こ雲淡風輕ζ 提交于 2019-12-24 09:49:59
问题 I'm saving an image loaded with Picasso to be shared afterwards. This is the code I'm using to save it: String path = MediaStore.Images.Media.insertImage( mContext.getContentResolver(), mImageBitmap, "Shared image", null); return Uri.parse(path); Now, when the image has been shared, I have to delete it using the URI. I've tried some answers I've seen here but none of them has worked. The image still appears in the gallery. These are the methods I have used: // Set up the projection (we only

Insert audio album in Android MediaStore

泄露秘密 提交于 2019-12-24 03:33:14
问题 I can't find any information about how to insert an album in MediaStore, I tried using Uri uri = contentResolver.insert(MediaStore.Audio.Albums.EXTERNAL_CONTENT_URI, albumValues); but I get an exception saying Invalid uri . This uri works fine for retrieving the albums but I can't use it to insert one. Here it is the rest of the code: ContentResolver contentResolver = getActivity().getContentResolver(); ContentValues albumValues = new ContentValues(); albumValues.put(Audio.Albums.ALBUM,

Get all captured Videos in Android as a list

99封情书 提交于 2019-12-23 01:55:25
问题 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,