android-gallery

How to Copy Image File from Gallery to another folder programmatically in Android

时间秒杀一切 提交于 2019-11-27 01:20:46
问题 I want to pick image from gallery and copy it in to other folder in SDCard. Code to Pick Image from Gallery Intent photoPickerIntent = new Intent(Intent.ACTION_PICK); photoPickerIntent.setType("image/*"); startActivityForResult(photoPickerIntent, REQUEST_CODE_CHOOSE_PICTURE_FROM_GALLARY); I get content://media/external/images/media/681 this URI onActivityResult. I want to copy the image, Form path ="content://media/external/images/media/681 To path = "file:///mnt/sdcard/sharedresources/ this

Android READ_EXTERNAL_STORAGE permission not working

∥☆過路亽.° 提交于 2019-11-26 22:01:00
问题 I'm trying to create a simple app that can get an image from the Gallery app and display it on an imageButton. I'm testing with API 21 on a phone running Android 5.0.1. Unfortunately, no matter what I try I keep getting a security error - even when I specify the permissions. My code for getting retrieving the image is: @Override protected void onActivityResult(int requestCode, int resultCode, Intent imageReturnedIntent){ super.onActivityResult(requestCode, resultCode, imageReturnedIntent);

Choosing photo using new Google Photos app is broken

ε祈祈猫儿з 提交于 2019-11-26 21:40:58
My app has ability to select photo from library. Exactly I want file path from this selection. This is the code to create intent for selecting photo: Intent photoPickerIntent = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI); photoPickerIntent.setType("image/*"); startActivityForResult(photoPickerIntent, INTENT_REQUEST_CODE_SELECT_PHOTO); This is the code that gets file path from URI: Cursor cursor = null; String path = null; try { String[] projection = { MediaStore.Images.Media.DATA }; cursor = context.getContentResolver().query(contentUri, projection, null, null,

How to implement HorizontalScrollView like Gallery?

倾然丶 夕夏残阳落幕 提交于 2019-11-26 21:22:35
I want to implement Horizontal ScrollView with some features of Gallery, In Gallery the scroll made at some distance it arrange in pair, i.e If we have three images shown in screen, clicking last image will arrange at center. How would I implement HorizontalSCrollView as mentioned? Vijju Try this code: activity_main.xml <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent" android:layout_height="100dip" tools:context=".MainActivity" > <HorizontalScrollView android:id="@+id/hsv" android:layout

How to save a bitmap image with imageview onclick [closed]

南笙酒味 提交于 2019-11-26 21:04:49
问题 Am developing a coloring of images in android. So after applying colors to my image when i click another imageview like save, then i have to save that image to gallery. 回答1: To get Bitmap from imageView : imageview.buildDrawingCache(); Bitmap bm=imageview.getDrawingCache(); To save it in a file: OutputStream fOut = null; Uri outputFileUri; try { File root = new File(Environment.getExternalStorageDirectory() + File.separator + "folder_name" + File.separator); root.mkdirs(); File

Choosing between camera and gallery for image selection

徘徊边缘 提交于 2019-11-26 20:32:29
问题 I am trying to allow a user to select an image, either from the gallery or by taking a picture with the camera. I tried this: Intent imageIntent = new Intent(Intent.ACTION_GET_CONTENT); imageIntent.setType("image/*"); startActivityForResult(Intent.createChooser(imageIntent, "Select Picture"), GET_IMAGE_REQUEST); but it automatically displays the gallery without even providing an option to choose an activity. It seems like there should be some better way to accomplish this than the solution

Image from Gallery in Android 6(Marshmallow)

99封情书 提交于 2019-11-26 20:27:34
问题 In My Application I am trying to Pick image from galley, so as to pass that image to server. Code is working fine on Android 5 and below, but for Android 6 on Nexus 5 I am not able to get image information. Log trace which I got Note : Code is working fine on Android 5 and below versions 11-06 12:27:43.736: W/System.err(31678): java.lang.SecurityException: Permission Denial: reading com.google.android.apps.photos.contentprovider.MediaContentProvider uri content://com.google.android.apps

Get filepath and filename of selected gallery image in Android

会有一股神秘感。 提交于 2019-11-26 20:26:29
I am creating an app which uploads a selected image from the gallery and uploads it to a web service. The webservice requires the filename of selected image plus a base64 encoding of the file contents. I have managed to achieve this with a hardcoded file path. However, I am struggling to get the real filepath of the image. I have read around the web and have this code, but it does not work for me: public void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == RESULT_OK) { Uri selectedImageUri = data.getData(); String[] projection = {MediaStore.Images.Media.DATA}

List out all images from SD card.

被刻印的时光 ゝ 提交于 2019-11-26 18:25:05
问题 Hi I am developing android Gallery app . I am fetching the images from a folder in sd card and displaying it on a grid view as below public static ArrayList<String> getFilePaths() { ArrayList<String> filePaths = new ArrayList<String>(); File directory = new File(android.os.Environment.getExternalStorageDirectory() + File.separator + AppConstant.PHOTO_ALBUM); // check for directory if (directory.isDirectory()) { // getting list of file paths File[] listFiles = directory.listFiles(); // Check

select multiple images in Android Gallery

风格不统一 提交于 2019-11-26 18:22:43
问题 i m working with one application that have one functionality to select multiple images from android inbuilt Gallery/Camera . Gallery is open successfully using below code. Intent intent = new Intent(); intent.setType("image/*"); intent.setAction(Intent.ACTION_GET_CONTENT); startActivityForResult(Intent.createChooser(intent,"Select Picture"), SELECT_PICTURE); but i am able to select only One image from Gallery. so please suggest me how to select multiple images from inbuilt gallery . Thanks in