1. *** New version of B4J is available ***
    B4J v7.8
    Dismiss Notice

Android Question Using Photos from the Phone

Discussion in 'Android Questions' started by Shadow&Max, Feb 3, 2014.

  1. Shadow&Max

    Shadow&Max Active Member Licensed User

    is your kitkat 4.4? Mine is 4.4 and this permission thing is a royal pain in the butt...
     
  2. barx

    barx Well-Known Member Licensed User

    so far ALL kitkat is 4.4 ;)
     
  3. Shadow&Max

    Shadow&Max Active Member Licensed User

    ok, wasn't sure. Thanks... Problem still exists lol!
     
  4. barx

    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
     
  5. Shadow&Max

    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...
     
    barx likes this.
  6. Erel

    Erel Administrator Staff Member Licensed User

  7. barx

    barx Well-Known Member Licensed User

    Do you have a example project I could load and run?
     
  8. Erel

    Erel Administrator Staff Member Licensed User

    Attached Files:

    • 1.zip
      File size:
      6.4 KB
      Views:
      669
    RauchG likes this.
  9. Erel

    Erel Administrator Staff Member Licensed User

    Have you checked the example above? It should work with all types of URIs.
     
  10. Gregg Homan

    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
     
  11. JordiCP

    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

    Code:
    (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)


    Code:
    (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?
     
  12. Erel

    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.
     
  13. JordiCP

    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.
     
  14. Erel

    Erel Administrator Staff Member Licensed User

  15. JordiCP

    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(..)
     
  16. Erel

    Erel Administrator Staff Member Licensed User

    Use the event parameters directly.
     
  17. JordiCP

    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!
     
  18. Erel

    Erel Administrator Staff Member Licensed User

    Yes (I thought that you were using it).
     
  19. JordiCP

    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
     
  20. Steini1980

    Steini1980 Member Licensed User

    Which Library does I need / contains the Type URI?
    Code:
    Dim uri1 As Uri
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice