mediastore

Android 10 MediaStore API changes

孤街浪徒 提交于 2020-01-24 16:24:31
问题 Uri uri = MediaStore.Audio.Artists.Albums.getContentUri("external", artistId); String[] projection = new String[] {BaseColumns._ID}; Cursor cursor = mContext.getApplicationContext().getContentResolver().query (uri, projection, null, null, null); Prior to Android 10, BaseColumns._ID was returning album_id and now in 10, it returns some random Id. When I passed projection as null and retrieved all column names below are the column name that I get. This is in Android 10. [numsongs, artist,

Get all photos from Android device android programming

China☆狼群 提交于 2020-01-14 11:53:06
问题 I am trying to fetch all the photos of my android device. I have an onCreate function: public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ImageAdapter adapter= new ImageAdapter(this); final String[] columns = { MediaStore.Images.Media.DATA, MediaStore.Images.Media._ID }; final String orderBy = MediaStore.Images.Media._ID; Uri rr= MediaStore.Images.Media.INTERNAL_CONTENT_URI; Cursor imagecursor = getContentResolver()

Video thumbnails not refreshing

一曲冷凌霜 提交于 2020-01-06 07:32:13
问题 I am showing all available videos in a gridView on which are in SDCard by using following code. String[] proj= {MediaStore.Video.Media._ID,MediaStore.Video.Media.DATA,MediaStore.Video.Media.DISPLAY_NAME, MediaStore.Video.Media.SIZE }; videocursor = getContentResolver().query(MediaStore.Video.Media.EXTERNAL_CONTENT_URI, proj, null, null, null); It is working fine... But if i made any changes to videos (i.e rename, delete) above code is not working. It is showing old content only, means not

Get the path from Uri in Android Kitkat throws Illegal Argument exception

自闭症网瘾萝莉.ら 提交于 2020-01-04 13:46:27
问题 I'm trying to get the path from uri. it works in devices below kitkat. I googled and found that I need to get the document Id and then query it with the gallery items. And it works. But I'm facing problem with videos. When i select the video from Videos section, it works. But When I select it from Gallery, my app crashes, giving Illegal Argument exception- Not a document type. I know why it's happening. It is because I'm looking for a document type of video in Gallery section. But how to

Is it possible to take a photo using Google Glass without “tap to accept”?

喜你入骨 提交于 2020-01-03 13:29:47
问题 I'm following the code here to capture an image with the Google Glass camera. https://developers.google.com/glass/develop/gdk/media-camera/camera#capturing_images_or_video Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); startActivityForResult(intent, 1); Everything is working fine, except that the camera activity requires the user to "tap to accept". Is it possible to just take the photo after a second or so? This is how the built-in camera app works, I just say "ok glass, take a

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

醉酒当歌 提交于 2020-01-02 04:23:05
问题 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); 回答1: I'm running into this exact same issue. Prior to the

Sort order in Android list from Mediastore

雨燕双飞 提交于 2019-12-31 03:03:39
问题 I need a video gallery on Android sorted by the newest. With the code below, the sorting is with oldest videos on top and newest videos on last. So I need to scroll the entire list before getting the new recorded videos. Any ideas to solve this ? private void init_phone_video_grid() { System.gc(); String[] proj = { MediaStore.Video.Media._ID, MediaStore.Video.Media.DATA, MediaStore.Video.Media.DISPLAY_NAME, MediaStore.Video.Media.SIZE }; videocursor = managedQuery(MediaStore.Video.Media

Sort order in Android list from Mediastore

こ雲淡風輕ζ 提交于 2019-12-31 03:03:24
问题 I need a video gallery on Android sorted by the newest. With the code below, the sorting is with oldest videos on top and newest videos on last. So I need to scroll the entire list before getting the new recorded videos. Any ideas to solve this ? private void init_phone_video_grid() { System.gc(); String[] proj = { MediaStore.Video.Media._ID, MediaStore.Video.Media.DATA, MediaStore.Video.Media.DISPLAY_NAME, MediaStore.Video.Media.SIZE }; videocursor = managedQuery(MediaStore.Video.Media

How to get the No of track from an Artist in mediastore

断了今生、忘了曾经 提交于 2019-12-25 18:02:59
问题 I am trying to get the no of track in Artist table using mediastore. I am able to get all the artist name but when I try to get the NUMBER_OF_TRACKS I am getting error .I searched and found this But this is not the problem in my case .Here is my code try { String[] proj = {MediaStore.Audio.Artists._ID, MediaStore.Audio.Artists.ARTIST, MediaStore.Audio.ArtistsColumns.NUMBER_OF_TRACKS, MediaStore.Audio.Artists.ARTIST_KEY ,MediaStore.Audio.Artists.NUMBER_OF_ALBUMS };// Can include more data for

Samsung Galaxy S7 show device photos rotated

旧城冷巷雨未停 提交于 2019-12-25 08:16:07
问题 I've developed an android app that shows in an adaptor all photos the user has in its device. This is the code I'm using to read the photos: Cursor photos; String pictureCols[] = { MediaStore.Images.Media._ID, MediaStore.Images.Media.DATA, MediaStore.Images.Media.BUCKET_DISPLAY_NAME }; String order = Media.DATE_ADDED + " DESC"; photos = getContentResolver().query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, pictureCols, null, null, order); photos.moveToFirst(); photosAdapter.addItems(photos)