Android ActionEdit crashes during saving result - android

I am developing application for TomTom navigation (Android 4.3). In my app I take some pictures and save them to some folder (external storage). When I want to edit the picture, I call the following piece of code:
Intent editIntent = new Intent(Intent.ActionEdit);
string currUri = ((ImageAdapter)gallery.Adapter).currURI;
editIntent.SetDataAndType(Android.Net.Uri.Parse(currUri), "image/*");
editIntent.SetFlags (ActivityFlags.GrantReadUriPermission);
StartActivityForResult(editIntent, 1);
This opens the default android gallery where I can process my picture. After that I click on Save button and the gallery app shows dialog :"Saving picture to edited online photos" and then the gallery crashes.
When I tried it on another device (API 19), it worked great and saved the picture to the same folder as original picure. Why does the gallery try to save edited picture to the folder called "EditedOnlinePhotos" on API 18? Is there any differnce in API 19?
This is the device log at the moment the app crashes:
device log
I spent a lot of time on it, however I was not able to solve it.
If you have any idea or need more information, feel free to reply. Thank you, I appreciate your help.

Related

Android photo gallery slow to recognize newly added image (caching issue?)

Is there a method that needs to be called to notify the OS that a new image has been added to the photo gallery?
I've got a camera application that allows a user to export images to a sub folder in the Android device's photo gallery.
The copy functionality works properly, but it can sometimes take anywhere from 10 seconds to 2 minutes for the gallery app to recognize that a new image has been added to the folder. And sometimes I need to exit the application, then return before it displays the new image. The behavior is the same whether I use the Samsung Gallery app or the Google photos app, which suggests it is an OS level cache.
I've verified the image is being written immediately within the device browser in Android studio.
You can add the current item to the OS's cache by using the following code:
// Add the file to the media database
var f = new Java.IO.File(fileInTargetDirectory);
var intent = new Intent(Intent.ActionMediaScannerScanFile);
intent.SetData(Android.Net.Uri.FromFile(f));
CrossCurrentActivity.Current.Activity.SendBroadcast(intent);

Multi Image Picker doesn't locate my image until I open Google Photos in Flutter

I'm using multi_image_picker to allow picking images in my Flutter app.
I've noticed odd behavior when I download an image and store in the Download folder of the device, and the following things happen:
After I download an image, I trigger the image picker (by running MultiImagePicker.pickImages).
Image Picker doesn't show the image, which is odd since I've downloaded the image.
I'm navigating to the Android Files app and I do find the image.
Restarting my app and navigating again to the Image Picker, but still - image not exists.
Opening Google Photos app and after a second the image appears.
Navigating back to my app -> Image Picker, and then I see the image.
I know it sounds odd. I have no idea how or why it happens. I'm using Flutter 1.10.3 and a fresh Android API 28 emulator. I ran the app in an Android Q too and the results are the same.
Looks like your download directory and your GooglePhotos sync directory are in two different places and MultiImage.pickImages is looking at the GooglePhotosSync directory (which might also be the devices CameraRoll directory).
So you are dependent on GooglePhotos uploading the photo from one place and downloading it to another.
Most of my work is ios so sorry I cant be more specific.
I observed similar behavior in terms of some photos not showing when picking image from gallery.
I just found the cause 5 minutes ago before asking "Have you found out the solution?"
It turns out, the flutter image pickter starts from "Recent" folder, the photos I have recently downloaded have much older timestamp. So these photos are futher down in the list.
I will look into a solution.

How to open the Gallery view Under My app

I am working on an App which is selecting a single picture at a time from the gallery. Right Now I have used the intent to open the gallery. But I do not want to use this. This is just because of the Use Case which is as below :
If the user Selects the Picture which is not in Portrait then my app should show him dialog to warn him that he is selecting the wrong Photo. Only Portrait photos are allowed.
So for this, I think If I would open the gallery by intent I can not achieve this, So I moved to another Idea , to bring all the photos from the gallery into the app. For this I tried using the Universal image loader, But Unfortunately it is slow and not looking good.
So is there any way to open the device Gallery into the app directly so please guide me share me the code or any link. thanks

Picture is not showing in Gallery App in Android

Hello I am trying to create a picture and save it into one directory of the SD card programmatically but when I go to gallery then these picture doesn't show there. It shows when I open any SD card browser app.
Is there any way to force so that picture appear in Gallery App also at the same time when I am saving the picture in my directory.
Thanks in advance.
The system does not scan the disk content all the time, it would kill the performances.
When you add a picture that the Gallery needs to pick-up, use
Intent intent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
intent.setData(Uri.fromFile(file));
sendBroadcast(intent);
This will allow the mediaScanner to have a look at the file immediately.
Note : if the file is incorrect for some reason, it will not have any effect.

When I try to push a photo onto the android emulator, I am not able to see the photo in Albums

I am new to Android and now trying to retrieve contact photo (thumb nail) from a content provider and set it onto my app. But for that as i am running on an AVD, i pushed some .png photos onto my 2.2 version. Now i tried to create a contact with the photo, but the Gallery is showing "No Media Found", hence i am stuck here.
Please help me in getting the photo visible in gallery.
Note : I am aware of the following facts :
I have restarted my AVD to force the Media Scanner to do its initial mockups.
Also i have seen the .png file through the File Explorer View of Eclipse Framework.
But strangely, I am not able to pull the file off the phone.
I have taken help of the link get the path of a Gallery Folder in Android for understanding the general view on Media Scanner.
I believe this is because the application doesn't know if there are images inside /data.
Try to put your images in:
/mnt/sdcard/Pictures

Categories

Resources