gallery

android : deleting an image

谁都会走 提交于 2019-11-26 03:38:30
问题 I am deleting an image file from my application. I was doing new File(filename).delete (); This was actually deleting the file. But the image was still visible in the gallery. On search i found that we should use getContentResolver().delete(Uri.fromFile(file), null,null); to delete But here i am getting the exception: Unknown file URL. java.lang.IllegalArgumentException: Unknown URL file:///mnt/sdcard/DCIM/Camera/IMG_20120523_122612.jpg When i see with any file browser, this particular image

Android get image from gallery into ImageView

若如初见. 提交于 2019-11-26 02:33:25
问题 I\'m trying to add a photo from galery to a ImageView but I get this error: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=1, result=-1, data=Intent { dat=content://media/external/images/media/1 }} to activity {hotMetter.pack/hotMetter.pack.GetPhoto}: java.lang.NullPointerException This is my code: Intent intent = new Intent(); intent.setType(\"image/*\"); intent.setAction(Intent.ACTION_GET_CONTENT); startActivityForResult(Intent.createChooser(intent,\

Android: Bitmaps loaded from gallery are rotated in ImageView

点点圈 提交于 2019-11-26 02:16:33
问题 When I load an image from the media gallery into a Bitmap, everything is working fine, except that pictures that were shot with the camera while holding the phone vertically, are rotated so that I always get a horizontal picture even though it appears vertical in the gallery. Why is that and how can I load it correctly? 回答1: Have you looked at the EXIF data of the images? It may know the orientation of the camera when the picture was taken. 回答2: So, as an example... First you need to create

Android: out of memory exception in Gallery

匆匆过客 提交于 2019-11-26 01:45:10
问题 My app shows a list of 9 categories and each category displays a Gallery-based coverflow (graciously offered by Neil Davies here) with images of the selected category. The images are fetched from the Web, each ranging from 300K to 500K in size, and stored in an arrayList of Drawables. This data is bound to the coverflow using a BaseAdapter (code below). Every time I exit the coverflow and go back to the list of categories, I clear the arrayList (again, code below). In scenario 1, my arrayList

android - save image into gallery

穿精又带淫゛_ 提交于 2019-11-26 01:13:05
问题 i have an app with a gallery of images and i want that the user can save it into his own gallery. I\'ve created an option menu with a single voice \"save\" to allow that but the problem is...how can i save the image into the gallery? this is my code: @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle item selection switch (item.getItemId()) { case R.id.menuFinale: imgView.setDrawingCacheEnabled(true); Bitmap bitmap = imgView.getDrawingCache(); File root = Environment

Image, saved to sdcard, doesn't appear in Android's Gallery app

落花浮王杯 提交于 2019-11-26 01:06:14
问题 I save an image to the sdcard and it doesn\'t appear in the Gallery application until I pull off the sdcard and return it back. Do you have any idea why is it so? Seems like the Gallery application has some cache that isn\'t updated on file save... Actually, I also want to open the just-saved image in Gallery application and have no success with that this is my question about this issue. 回答1: The system scans the SD card when it is mounted to find any new image (and other) files. If you are

android pick images from gallery

筅森魡賤 提交于 2019-11-26 00:26:56
问题 I want to create a picture chooser from gallery. I use code intent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); startActivityForResult(intent, TFRequestCodes.GALLERY); My problem is that in this activity and video files are displayed. Is there a way to filter displayed files so that no video files will be displayed in this activity? 回答1: Absolutely. Try this: Intent intent = new Intent(); intent.setType("image/*"); intent.setAction(Intent

Horizontal ListView in Android?

独自空忆成欢 提交于 2019-11-25 22:34:47
问题 Is it possible to make the ListView horizontally? I have done this Using gallery view, but the selected item comes to the center of the screen automatically. I don\'t want the selected item at the same spot I clicked. How can I Rectify this Problem? My Idea was to set the ListView with horizontal scroll. Share your idea? 回答1: As per Android Documentation RecyclerView is the new way to organize the items in listview and to be displayed horizontally Advantages: Since by using Recyclerview

Get/pick an image from Android's built-in Gallery app programmatically

青春壹個敷衍的年華 提交于 2019-11-25 21:57:15
问题 I am trying to open an image / picture in the Gallery built-in app from inside my application. I have a URI of the picture (the picture is located on the SD card). Do you have any suggestions? 回答1: This is a complete solution. I've just updated this example code with the information provided in the answer below by @mad. Also check the solution below from @Khobaib explaining how to deal with picasa images. Update I've just reviewed my original answer and created a simple Android Studio project

Image, saved to sdcard, doesn't appear in Android's Gallery app

泪湿孤枕 提交于 2019-11-25 20:37:20
I save an image to the sdcard and it doesn't appear in the Gallery application until I pull off the sdcard and return it back. Do you have any idea why is it so? Seems like the Gallery application has some cache that isn't updated on file save... Actually, I also want to open the just-saved image in Gallery application and have no success with that this is my question about this issue. The system scans the SD card when it is mounted to find any new image (and other) files. If you are programmatically adding a file, then you can use this class: http://developer.android.com/reference/android