Android Question Camera EZ Result

Discussion in 'Android Questions' started by Douglas Farias, Feb 18, 2015.

  1. Douglas Farias

    Douglas Farias Expert Licensed User

    Hi all
    I m using the camera ez to take photos with the native camera.
    Ok, this works fine on some devices, but i have a problem with samsung devices.

    http://www.b4x.com/android/forum/threads/ezcamera.22931/#content

    The event _picturetaken dont work on some samsung devices.
    The Creator of this lib @Roger Garstang leave the forum many time ago.

    i have tested with native camera intent too and the result is null ever on some devices
    Code:
    Sub OpenCam(Directory As String, PictureName As String)

        
    Dim i As Intent

        i.Initialize(
    "android.media.action.IMAGE_CAPTURE""")
        i.PutExtra(
    "output", ParseUri("file://" & File.Combine(Directory, PictureName)))
              
        
    StartActivity(i)
              
    End Sub

    Sub ParseUri(FileName As StringAs Object

        
    Dim r As Reflector

        
    Return r.RunStaticMethod("android.net.Uri""parse"Array As Object(FileName), Array As String("java.lang.String"))

    End Sub
    the two codes are good and works fine and well on some devices.
    but i really dont know why this dont work on some devices, the event _picturetaken dont is called or the intent return null

    What the solution to this lib or this snipp code works fine on all devices?
     
    Last edited: Feb 18, 2015
  2. Erel

    Erel Administrator Staff Member Licensed User

    I've removed the decompiled code. Do not post it unless Roger explicitly allows you to decompile his libraries.
     
  3. Douglas Farias

    Douglas Farias Expert Licensed User

    ok and the fix for the bug?

    this have nothing special
    Code:
    public void TakePicture(String Directory, String FileName)
      {
        
    Intent i = new Intent("android.media.action.IMAGE_CAPTURE");
    converted to b4a it is
    Code:
    Sub OpenCam(Directory As String, PictureName As String)

        
    Dim i As Intent

        i.Initialize(
    "android.media.action.IMAGE_CAPTURE""")
        i.PutExtra(
    "output", ParseUri("file://" & File.Combine(Directory, PictureName)))
               
        
    StartActivity(i)
               
    End Sub

    Sub ParseUri(FileName As StringAs Object

        
    Dim r As Reflector

        
    Return r.RunStaticMethod("android.net.Uri""parse"Array As Object(FileName), Array As String("java.lang.String"))

    End Sub
    why this works on some devices and some devices dont work? the intent looks corret, the camera ez code looks correct too
     
  4. thedesolatesoul

    thedesolatesoul Expert Licensed User

    I guess it depends on the device.
    You only open an intent for standard image capture, but if the device's camera app for e.g. does not support returning a value from the intent then it may not work.
    What you can do instead is to use a flag when you fire the intent, and then check that in activity_resume.
    Alternatively look at the first thread in 'Similar threads' on the top of this thread.
     
    DonManfred and NJDude like this.
  5. Douglas Farias

    Douglas Farias Expert Licensed User

  6. thedesolatesoul

    thedesolatesoul Expert Licensed User

    What do you mean 'original' fix?
    If the manufacturers broke it in their devices, then only they can give you an original fix.
    You will have to fix each solution separately as those threads indicate there are many issue with the camera (returns null, doesnt return, doesnt insert in gallery, does insert in gallery, orientation issues).
     
    DonManfred and NJDude like this.
  7. Douglas Farias

    Douglas Farias Expert Licensed User

  8. thedesolatesoul

    thedesolatesoul Expert Licensed User

    I can help you, but this is not the solution to the bug you are facing. Did you read the post?
     
    joulongleu, Douglas Farias and NJDude like this.
  9. Douglas Farias

    Douglas Farias Expert Licensed User

  10. thedesolatesoul

    thedesolatesoul Expert Licensed User

  11. Douglas Farias

    Douglas Farias Expert Licensed User

    i really dont know how to search this in english, i m not good with english
    i think the bug its on the
    Code:
    this.ion = new IOnActivityResult()
        {
          
    public void ResultArrived(int resultCode, Intent intent)
          {
            
    if (resultCode == -1) {
              
    EZcamera.this.ba.raiseEvent(EZcamera.this, EZcamera.this.eventName + "_picturetaken", new Object[] { Boolean.valueOf(true});
            } else {
              EZcamera.this.ba.raiseEvent(EZcamera.this, EZcamera.this.eventName + "_picturetaken", new Object[] { Boolean.valueOf(false) });
            }
          }
        };
        this.ba.startActivityForResult(this.ion, i);
      }
    in some devices the event _picturetaken dont work, only this i know writein english

    i think this is the problem
    http://stackoverflow.com/questions/...ge-capture-intent-returning-null-data-getdata

    http://kemstack.co.in/wordpress/zam...amera-intent-do-not-return-after-photo-taken/
     
  12. DonManfred

    DonManfred Expert Licensed User

    no. and he did NOT recognize that there is NO "fixed" answer (no answer is marked mwith a green sign)

    My suggestion to douglas: Learn JAVA and write a new bug free Camera-Library for us.
    Then we have (MAYBE!) a bug free version :)
     
    Peter Simpson likes this.
  13. Douglas Farias

    Douglas Farias Expert Licensed User

    I wanted, but Learn to 0% and try to fix a camera (Advanced) It is not possible to beginner. I need Learn java 5 or 6 months only for try fix the camera.

    i know this, for this i m trying to find a solution here on the forum.
    dont need is the original fix, but only find a solution for some devices.

    i dont know use try, catch etc on java, if i think need make a check ,
    1° - take picture
    2° - try to save in the informed place (folde, picture name)
    3° - if the 2° dont work, try save on another place
    4° - if the 3° dont work, the phone dont save on the informed place (try save get the path of original place, where this is saved with the correct name file)
    5° - return this to b4a (path)

    this only checks if is == -1
    Code:
    this.ion = new IOnActivityResult()
        {
          
    public void ResultArrived(int resultCode, Intent intent)
          {
            
    if (resultCode == -1) {
              
    EZcamera.this.ba.raiseEvent(EZcamera.this, EZcamera.this.eventName + "_picturetaken", new Object[] { Boolean.valueOf(true});
            } else {
              EZcamera.this.ba.raiseEvent(EZcamera.this, EZcamera.this.eventName + "_picturetaken", new Object[] { Boolean.valueOf(false) });
            }
          }
        };
        this.ba.startActivityForResult(this.ion, i);
      }
    but i dont know how to make all this checks on java =(


    another users with this problem
    http://www.b4x.com/android/forum/threads/ezcamera.22931/#post-150917
    http://www.b4x.com/android/forum/threads/ezcamera.22931/page-2#post-269661
    http://www.b4x.com/android/forum/threads/ezcamera.22931/#post-150950
    http://www.b4x.com/android/forum/threads/getting-data-back-from-camera-app-intent.11378/#post-132956
    http://www.b4x.com/android/forum/threads/getting-data-back-from-camera-app-intent.11378/#post-132964
    http://www.b4x.com/android/forum/threads/getting-data-back-from-camera-app-intent.11378/#post-132985
     
    Last edited: Feb 18, 2015
  14. DonManfred

    DonManfred Expert Licensed User

    BULLSHIT DOUGLAS! TELL US NO SHIT!

    I STARTED LEARNING JAVA 3 months ago! Before that i DID NOT KNOW ANY LINE JAVA.
    Have you seen what i wrote on libraries in the last months?
     
  15. thedesolatesoul

    thedesolatesoul Expert Licensed User

    You cant solve this problem without understanding it. There is no magic bullet.

    Just take a while, relax, clear your mind and think about it. Dont go on the internet search spree when you cannot understand what they are saying. Chill.

    Now, let me tell you, there is no real solution to this problem. There is no magic one line of java code or a stack overflow answer that will solve all your problems. This is not one problem, this is 10 problems. You have to work at them one after the other. And there is no 'good' or 'elegant' solution. There is only 'workarounds'.
    If you want to be a problem solver, you need to think about how to solve problems, not how to find solutions.

    Firstly, you should stop posting EZCamera code for two reasons:
    - It doesnt work
    - You are not allowed to post some elses decompiled code

    Secondly, to do the check above I already linked you to this thread: http://www.b4x.com/android/forum/threads/using-startactivityforresult-with-javaobject.40374/
    This checks the result code.
    But this will not solve your problem again because no intent is raised.

    That is why I told you initially to use activity_resume and a flag.



    Yes, there is no fixed answer.
    Possibly Camera2 or Camera3 API will be bug free.
     
    NJDude, DonManfred and Douglas Farias like this.
  16. Douglas Farias

    Douglas Farias Expert Licensed User

    3 months =)
    ok, what the fix for this camera bug? ;)
     
  17. DonManfred

    DonManfred Expert Licensed User

    Did i say somewhere that I will fix YOUR problems?????

    Welcome back on my ignore-list! AGAIN!

    And this time i will NOT remove you again from this list! I SWEAR!
     
    Last edited by a moderator: Feb 19, 2015
  18. Douglas Farias

    Douglas Farias Expert Licensed User

    Resume = no fix
    the only solution is this
    http://www.b4x.com/android/forum/threads/ezcamera.22931/#post-175164

    but have a way to get a path when the picture is saved with random name on random place?
    http://www.b4x.com/android/forum/threads/getting-data-back-from-camera-app-intent.11378/#post-132956
     
  19. Douglas Farias

    Douglas Farias Expert Licensed User

    why the ignorance?
    u tell me to learn java, i say i need to learn 5,6 months to fix this

    u tell me
    ok, 3 months. know fix the bug? nop
    whats the problem here? why the ignorance? my afirmation its correct need 5 6 months to fix this ¬¬

    i m only trying to fix a camera bug here on the forum.
    your posts dont help me



    ty for u help
    @thedesolatesoul
    you explained my question .
     
    Last edited: Feb 18, 2015
  20. thedesolatesoul

    thedesolatesoul Expert Licensed User

    Yes, this is exactly the solution.

    Now for part2. If it gets saved to a random location, you can fetch that using the media browser lib. If you order by date you will get the last taken picture at the top.
     
    NJDude and Douglas Farias like this.
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