mediastore

How do I save data from Camera to disk using MediaStore on Android?

萝らか妹 提交于 2019-12-17 07:21:30
问题 For my application, I'd been using my own Camera class for taking images and my own database but soon enough I couldn't really keep up with changes and I decided to use the built in camera application in Android to do the job, but I can't seem to get it to save file. What am I missing here? The application seems to save the file but it's just 0 bytes. I looked up the source code of the Camera application and it's looking for the "output" in Extras to save the file. Any help would be greatly

how to detect if is running the scan for new media files on Android (in background)

此生再无相见时 提交于 2019-12-14 02:46:54
问题 I have two activity: Main and Processing. in the Processing activity do an edit operation on the file names in a folder, and then start a scan to update via broadcast, and I check when the scan finish. //end batch renaming operation //start updating media store library sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED,Uri.parse("file://"+Environment.getExternalStorageDirectory()))); //show toast "updating" op_media_mounted.show(); //catch when updaitng op ends IntentFilter filter = new

How to set ringtone through an android application?

本小妞迷上赌 提交于 2019-12-13 21:16:53
问题 I am trying set a ringtone through my android application. I tried with this code public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); String filepath ="/sdcard/sound.mp3"; File ringtoneFile = new File(filepath); ContentValues content = new ContentValues(); content.put(MediaStore.MediaColumns.DATA,ringtoneFile.getAbsolutePath()); System.out.println(ringtoneFile.getAbsolutePath()+"+++++++++++++++++++++++++"); content.put

What is size of thumbnail returned by ACTION_IMAGE_CAPTURE intent

梦想与她 提交于 2019-12-13 16:06:58
问题 I'm using the standard camera intent to take a photo: Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); startActivityForResult(takePictureIntent, actionCode); And then in onActivityResult () Bundle extras = intent.getExtras(); Bitmap imageBitmap = (Bitmap) extras.get("data"); mImageView.setImageBitmap(imageBitmap); Bitmap is a thumbnail. That's great - I don't need full size images. Before user can take a photo, I display a default thumbnail that they can click and that

Refresh MediaStore for Images & Videos

瘦欲@ 提交于 2019-12-13 07:51:16
问题 I moving and deleting lots of images and videos as per my requirement and now i am scan media by using Intent scanFileIntent = new Intent( Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, uri); sendBroadcast(scanFileIntent); all working fine but sometime freeze the screen, i think some issue in MediaScanner. And my second quetion is how to scan all media Store rether than scan perticuler File. Thanks in Advance!! 回答1: You should try this solution for amove and delete the image. Pass file directory path

How does one load .gif images from the Android Mediastore

坚强是说给别人听的谎言 提交于 2019-12-13 06:53:40
问题 i need to load a couple of gifs into a custom gallery view. using the mediastore only provides me with png/jpg image types. after a couple of hours googleing i still could not find the answer.. the code i use to load images from the mediastore is: final String sortOrder = mPreferences.getSortMode(); final Uri uri = android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI; String[] projection = { MediaStore.MediaColumns.DATA, MediaStore.Images.Media.BUCKET_ID, MediaStore.Images.Media

Cursor for an Image always returns null

六眼飞鱼酱① 提交于 2019-12-13 04:59:56
问题 I'm storing a picture from my Camera like this: String newName = new BigInteger(130, new SecureRandom()) .toString(24); File mydir = new File(Environment.getExternalStorageDirectory().getAbsolutePath(), CameraActivity.DIR_PICTURES); mydir.mkdirs(); fileWithinMyDir = new File(mydir, newName + ".png"); out = new FileOutputStream(fileWithinMyDir); finalBitmap.compress(Bitmap.CompressFormat.PNG, 100, out); where CameraActivity.DIR_PICTURES stands for "com.korcholis.testapp/pictures" . Nothing

Async download of images to gridview from MediaStore

余生长醉 提交于 2019-12-13 04:17:14
问题 I have a gridview of about 1500 images. I'm using thumbnails from MediaStore to show them. But when I've populated the grid in UI thread it worked too slow for the first time (thumbnails not created yet?). So I've decided to move this process to background. Using this tutorial and one another I've written this class: public class ImageLoader { // ----------------------------------------------------------------------- // // Fields // // ---------------------------------------------------------

internal vs external uri on fetching data from mediastore

感情迁移 提交于 2019-12-12 12:07:18
问题 Hopefully someone can clarify this to me...I am working on a simple video player app that plays video clip stored on phone. All examples I've seen fetch video using MediaStore.Video.Media.EXTERNAL_CONTENT_URI content Uri, something like that cursor = resolver.query(MediaStore.Video.Media.EXTERNAL_CONTENT_URI, cols, whereClause, null, sortOrder); But won't it limit the list to only files stored on SD card? Newer android phones has significant amount of internal memory - for example, Samsung

get genre_id and audio_id from audio_genres_map from mediastore

落花浮王杯 提交于 2019-12-12 03:28:50
问题 I want to retrieve whole audio_genres_map table from mediastore in one query. I have all the audio info and genre info but the missing piece is the mapping. I am able to do it in multiple queries. I want to achieve it one query 回答1: managed to solve this using following query String[] genresProjection = { Audio.Genres.Members.AUDIO_ID, Audio.Genres.Members.GENRE_ID }; context.getContentResolver().query(Uri.parse("content://media/external/audio/genres/all/members"), genresProjection, null,