android-gallery

Picture taken from camera or gallery when using in imageview its orientation getting changed, and sometimes vertically stretched in Android

我们两清 提交于 2019-12-19 02:42:16
问题 In my application I have to capture image from camera or import from gallery, show it in imageview in activity. Everything is fine, I am getting image from both and able to set it on imageview without any exception. But sometimes image is not getting scaled properly and gets vertically stretched or with orientation changed. Please help me out. Here is my code to decode image referred from official android documentation: public static Bitmap decodeSampledBitmapFromResource(File photoFile, int

How can I display a specific folder in Android Gallery3D (cooliris)?

本秂侑毒 提交于 2019-12-18 03:44:47
问题 I'm using Gallery3D (froyo-stable) I'm trying to make a little app that displays only images from a specific folder in a gallery view. Uri targetUri = Media.EXTERNAL_CONTENT_URI; String folderPath = Environment.getExternalStorageDirectory().toString() + "/DCIM/"; int folderBucketId = folderPath.toLowerCase().hashCode(); targetUri = targetUri.buildUpon().appendQueryParameter("bucketId", String.valueOf(folderBucketId)).build(); In initializeDataSource() // Creating the DataSource objects. final

How to select a video from the gallery and get it's real path?

别等时光非礼了梦想. 提交于 2019-12-17 23:25:40
问题 I can open the gallery with this code, Intent intent = new Intent(Intent.ACTION_PICK); intent.setType("video/*"); intent.setAction(Intent.ACTION_GET_CONTENT); startActivityForResult(Intent.createChooser(intent, "Select Video"), PICK_VIDEO_REQUEST ); It works well on a Samsung Galaxy S5. But in some phones, images are displayed along with videos. What changes do I need to do to the code to open the gallery to display only videos? How can I get the real path of the selected video when the

Get Image from the Gallery and Show in ImageView

拈花ヽ惹草 提交于 2019-12-17 09:35:43
问题 I need to get an image from the gallery on a button click and show it into the imageview. I am doing it in the following way: btn_image_button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { getImageFromAlbum(); } }); The method Definition is as: private void getImageFromAlbum(){ try{ Intent i = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); startActivityForResult(i, RESULT_LOAD_IMAGE); }catch(Exception

Choosing photo using new Google Photos app is broken

不羁的心 提交于 2019-12-17 05:40:48
问题 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 = {

Choosing photo using new Google Photos app is broken

左心房为你撑大大i 提交于 2019-12-17 05:40:21
问题 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 = {

Gallery with folder filter

不打扰是莪最后的温柔 提交于 2019-12-17 04:01:26
问题 I'm using following code to open a gallery inside of my app Intent intent = new Intent(Intent.ACTION_GET_CONTENT); intent.setType("image/*"); startActivityForResult(intent, FIND_RESULT); Is it possible to limit a list of images to only show images taken by camera? Viewing Gallery on my 2.1 system, images are grouped so there has to be a parameter that defines to which folder it belongs. Checking the MediaStore.Images.ImageColumns I did not a find any column that would define such thing. Could

Open Gallery Folder By Click On Notification

偶尔善良 提交于 2019-12-14 02:55:06
问题 I used this code to send notification. public static void sendNotificationPhoto(Context context, Class<?> activityTarget) { Log.i( TAG , "Send Photo Notification"); NotificationManager mNotificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE); Notification notifyDetails = new Notification(R.drawable.ic_plusone_standard_off_client, "New Alert!", System.currentTimeMillis()); Intent intent = new Intent(context, activityTarget); int id = NOTIFICATION_ID

How to listen new photos in android?

Deadly 提交于 2019-12-13 11:48:31
问题 I need to listen to new images that comes from any source like downloading images, capture new images, other apps download images..etc Is there any listener that will trigger event whenever new photos is added to gallery? I have been searching for two days. I could not get anything solid. I read about FileObserver , will that help? 回答1: new photos arrives to gallery means it has been added to the MediaStore . First of all, FileOberver is a memory-killer approach. Consider a high volume of

Save two images as a single image in android

梦想的初衷 提交于 2019-12-13 09:49:18
问题 I have an image view in android and on that image view i have another image view.. Both image views contain two different images.. Now i want to save it as a single JPG image in my phone gallery.. So how can i do that?? I tried some code but it is not working. Here is my code. XML File: <ImageView android:id="@+id/innerImage" android:layout_width="300dp" android:layout_height="230dp" android:layout_centerInParent="true" android:layout_centerVertical="true" android:contentDescription="@android