Android Question Camera EZ Result

Douglas Farias

Expert
Licensed User
Longtime 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.

https://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
B4X:
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 String) As 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:

Douglas Farias

Expert
Licensed User
Longtime User
ok and the fix for the bug?

this have nothing special
B4X:
  public void TakePicture(String Directory, String FileName)
  {
    Intent i = new Intent("android.media.action.IMAGE_CAPTURE");

converted to b4a it is
B4X:
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 String) As 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
 
Upvote 0

thedesolatesoul

Expert
Licensed User
Longtime 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.
 
Upvote 0

thedesolatesoul

Expert
Licensed User
Longtime 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).
 
Upvote 0

Douglas Farias

Expert
Licensed User
Longtime User
i really dont know how to search this in english, i m not good with english
i think the bug its on the
B4X:
    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/
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Did you read the post?
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 :)
 
Upvote 0

Douglas Farias

Expert
Licensed User
Longtime 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.

no. and he did NOT recognize that there is NO "fixed" answer (no answer is marked mwith a green sign)
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
B4X:
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
https://www.b4x.com/android/forum/threads/ezcamera.22931/#post-150917
https://www.b4x.com/android/forum/threads/ezcamera.22931/page-2#post-269661
https://www.b4x.com/android/forum/threads/ezcamera.22931/#post-150950
https://www.b4x.com/android/forum/t...ack-from-camera-app-intent.11378/#post-132956
https://www.b4x.com/android/forum/t...ack-from-camera-app-intent.11378/#post-132964
https://www.b4x.com/android/forum/t...ack-from-camera-app-intent.11378/#post-132985
 
Last edited:
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
I need Learn java 5 or 6 months only for try fix the camera.
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?
 
Upvote 0

thedesolatesoul

Expert
Licensed User
Longtime User
i really dont know how to search this in english, i m not good with english
i think the bug its on the
B4X:
    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/
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: https://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.



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 :)
Yes, there is no fixed answer.
Possibly Camera2 or Camera3 API will be bug free.
 
Upvote 0

Douglas Farias

Expert
Licensed User
Longtime 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: https://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.

Resume = no fix
the only solution is this
https://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?
https://www.b4x.com/android/forum/t...ack-from-camera-app-intent.11378/#post-132956
 
Upvote 0

Douglas Farias

Expert
Licensed User
Longtime User
FUCK YOU ASHOLE!

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!

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

u tell me
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?

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

learn java



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: https://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.
ty for u help
@thedesolatesoul
you explained my question .
 
Last edited:
Upvote 0

thedesolatesoul

Expert
Licensed User
Longtime User
Resume = no fix
the only solution is this
https://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?
https://www.b4x.com/android/forum/t...ack-from-camera-app-intent.11378/#post-132956
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.
 
Upvote 0
Top