Android Question Using Photos from the Phone

barx

Well-Known Member
Licensed User
Indeed it does, if you would like me to test a project on nexus 7 I can. That way you will know if it only certain devices. Probably won't have time now though until tomorrow evening. Probably not much use to you, sorry. But if your still in the same position tomorrow.....

Good luck
 

Shadow&Max

Active Member
Licensed User
Thanx Barx! Na, that's not necessary. I'm doing a workaround of my own and restoring the pictures in the internal storage, then nuke them when I don't need them. Finding out that it works on the Nexus 7 doesn't help with every other device that's out there, but I really appreciate the offer...
 

Erel

Administrator
Staff member
Licensed User
Have you checked the example above? It should work with all types of URIs.
 

Gregg Homan

Member
Licensed User
Erel,

I totally overlooked your post #28. For some strange reason I never got alerted that this thread was updated after my last post#20 so I failed to realize that posts #21-28 existed until just now as I write. Thanks for the above fix though I did come to realize that the workaround discussed in post #9 above actually worked quite well for I was able use the temporary work directory to re-size the images being processed by my app.

Thanks,
Gregg
 

JordiCP

Well-Known Member
Licensed User
I post my question here since I think it is related to this thread.

My app is picking images from the gallery using ACTION_PICK intent and then decoding the result with GetPathFromContentResult It works fine for gallery folder and also, for instance, for "whatsapp images" folder and others


But on some devices, the returned string when picking from the gallery (from other folders it still works) is

B4X:
(AIRPLANE MODE OFF) --> here it crashes ( GetPathFromContentResult returns null)

content://com.google.android.apps.photos.content/0/https%3A%2F%2Flh6.googleusercontent.com%2Fy8zxYXsru....(a large string which changes each time)


B4X:
(AIRPLANE MODE ON) --> here it works (GetPathfromcontentresult returns "/storage/sdcard0/DCIM/Camera/..."

content://media/external/images/media/3198...

It seems to be as if, even if the picture is in the device, it is referenced as a server link. I have no idea at all

Anyone has found this? Any workaround?
 

Erel

Administrator
Staff member
Licensed User
Why do you need the actual path? There can be cases where there is no path available. The image can come from a database for example.
 

JordiCP

Well-Known Member
Licensed User
It is a picture that is stored in the same device.

I do this in my camera app. The user chooses a picture from the gallery (using intent.ACTION_PICK). Then, on Activity_OnResult, the app tries to get the path using GetPathFromContentResult, copies it to a temporary folder and let the user edit this new copy.

But I was reported that on some phones (SGIII mini, for instance) it didn't work, and finally found the why. But not the solution. Seems like when you are online, the result is different than when you are with no network.
 

JordiCP

Well-Known Member
Licensed User
Yes, I am using the latest version.

So you mean that in my case I can use the above code? But I don't know the Dir and Filename valies to use for File.OpenInput(..)
 

JordiCP

Well-Known Member
Licensed User
You mean I need to use ContentChooser? I was using intent.ACTION_PICK, but will try with it

Thanks!
 

JordiCP

Well-Known Member
Licensed User
Now it works ok ;) In fact I had already used ContentChooser, but don't know why decided to try with intents
 
Top