android-gallery

fetching images from gallery on android phones with internal storage

寵の児 提交于 2020-01-23 05:55:05
问题 Hi I am developing an Android Gallery app where I am fetching images from built in gallery and displaying it.I am using the code as below String[] projection = {MediaStore.Images.Thumbnails._ID}; Cursor cursor = getContentResolver().query(MediaStore.Images.Thumbnails.INTERNAL_CONTENT_URI, projection, // Which columns to return null, // Return all rows null, null); int columnIndex = cursor.getColumnIndexOrThrow(MediaStore.Images.Thumbnails._ID); int size = cursor.getCount(); // If size is 0,

fetching images from gallery on android phones with internal storage

ε祈祈猫儿з 提交于 2020-01-23 05:54:54
问题 Hi I am developing an Android Gallery app where I am fetching images from built in gallery and displaying it.I am using the code as below String[] projection = {MediaStore.Images.Thumbnails._ID}; Cursor cursor = getContentResolver().query(MediaStore.Images.Thumbnails.INTERNAL_CONTENT_URI, projection, // Which columns to return null, // Return all rows null, null); int columnIndex = cursor.getColumnIndexOrThrow(MediaStore.Images.Thumbnails._ID); int size = cursor.getCount(); // If size is 0,

Android get Gallery image Uri path

你。 提交于 2020-01-19 05:07:30
问题 In an Activity, I can choose an image from the Gallery, and I need its Uri path (in the log, the Uri path for my test image is /content:/media/external/images/media/1 ). I'm getting this error though: 08-04 02:14:21.912: DEBUG/PHOTOUPLOADER(576): java.io.FileNotFoundException: /content:/media/external/images/media/1 (No such file or directory) 08-04 02:14:32.124: WARN/System.err(576): java.io.FileNotFoundException: /content:/media/external/images/media/1 (No such file or directory) Is this

Pick multiple images form gallery in Redmi mobile

我是研究僧i 提交于 2020-01-16 08:36:14
问题 Below code is not working in Redmi 4A ...it's working maximum devices it not working only Redmi 4A..i donot know it's throwing Nullpointer exception Error: Exeception: something went wrongjava.lang.NullPointerException: Attempt to invoke virtual method 'int android.content.ClipData.getItemCount()' on a null object reference if (Build.VERSION.SDK_INT < 19) { Intent galleryIntent = new Intent(Intent.ACTION_GET_CONTENT,android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); galleryIntent

Using the default android image Viewer to show pics

流过昼夜 提交于 2020-01-15 06:57:19
问题 I know that I can open an image using the default android image Viewer, for example with new Intent(Intent.ACTION_VIEW) etc. If I open the image and then I swipe left/right I'll see the other images saved on the device. For example, if I open one of whatsapp images, swiping left/right I'll see all other images saved inside whatsapp folder. Is there a way to pass the default android image Viewer a List / Array of uri, in order to prevent users from swiping left/right and see all the images on

how to send images to gallery for setting the wallpaper?

狂风中的少年 提交于 2020-01-14 03:38:08
问题 i was trying to integrate set as wallpaper option using default gallery app, I don't know how to send the image to gallery using intent. I am attaching fb app samples how its look like. String root = Environment.getExternalStorageDirectory().toString(); new File(root + "/"+Constants1.APPNAME).mkdirs(); File fileForImage = new File(root + "/"+Constants1.APPNAME, pos + ".jpg"); if (fileForImage.exists()) fileForImage.delete(); try { FileOutputStream out = new FileOutputStream(fileForImage);

Picking an image file from Gallery using FileProvider

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-13 07:42:10
问题 Compiling for Android N I've faced an issue of FileProvider . I need to let user to pick image from gallery/take picture with camera then crop it to square. I've managed to implement a FileProvider for taking image with camera, but I have serious problem with picking image from gallery. The problem is that in the gallery there are lot of files from different places and I've got the Exception for example: java.lang.IllegalArgumentException: Failed to find configured root that contains /storage

Save ImageView to Android Emulator Gallery

三世轮回 提交于 2020-01-11 12:34:07
问题 I'd like to Save an Image to the Android Gallery, here's my current code: image.setDrawingCacheEnabled(true); image.buildDrawingCache(true); Bitmap b = image.getDrawingCache(); if(!new File("/"+Environment.DIRECTORY_PICTURES).exists()) Log.e("Error","/"+Environment.DIRECTORY_PICTURES+" Dont exist"); File file = new File(Environment.DIRECTORY_PICTURES+"/myImage.jpg"); file.createNewFile(); FileOutputStream ostream = new FileOutputStream(file); b.compress(CompressFormat.JPEG, 80, ostream);

Open Gallery App in Android

半城伤御伤魂 提交于 2020-01-10 08:32:06
问题 I am trying to open inbuilt gallery app pressing a button in my app. I am trying out on Android 2.3 and above phones. The phones/tablet that I have are Samsung S (Android 2.3.5) LG phone (Android 2.3.3) Nexus One (Android 2.3.6) Android Tablet (Android 4.0.3) Galaxy Nexus (Android 4.3) I tried the following: Intent intent = new Intent(Intent.ACTION_VIEW, null); intent.setType("image/*"); startActivity(intent); above code works fine on Android tablet (4.0.3) and my Nexus phone too.. but if run

How to rotate image to its default orientation selected from gallery in Android?

别等时光非礼了梦想. 提交于 2020-01-05 04:05:13
问题 When ever I select image from gallery and set it in image view. It becomes rotated. I want it in its default orientation. 回答1: It worked for me properly (this code is combination from two different sources) to solve image rotation when selected from gallery. @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == PICK_IMAGE_REQUEST && data != null && data.getData() != null) { Uri uri =