AdvancedCamera: Camera1.CameraFront gives error

awama

Active Member
Licensed User
Longtime User
When I try to activate the front camera, I get the following error:

Sub Activity_Resume
camera1.Initialize (Panel1, "Camera1")
camera1.CameraFront2 () '. CameraFront
'camera1.CameraBack 'works fine
End Sub

Error: java.lang.NullPointerException

I have the Galaxy S2 ICS 4.0.3
 
Last edited:

NJDude

Expert
Licensed User
Longtime User
I ran the sample (frontcam-example-project.zip) and got an error on this line:
B4X:
FC.SetZoomIn

I had to do this to get it to work:
B4X:
FC.SetZoomIn(1)

Even though the tooltip says "SetZoomIn() No need to pass anything", also, it doesn't work on a Nexus 7 tab (Jelly Bean), but worked fine on an EVO 4G LTE (ICS)

On an EVO 4G (Froyo) it activated the BACK camera not the front one (FrontCameExamplePreGingerBread2.3.zip).

I used lib version 2.0.
 
Last edited:
Upvote 0

msawada

Member
Licensed User
Longtime User
Can't get front camera on Nexus 7 to show preview image

Any progress on this issue? I can't get the front camera on the Nexus to show a preview image. I've tried the AdvancedCamera lib and v2 of VBFrontCam (as well as 1.3) (BTW: The version number of VBFrontCam in the library tab of the IDE always shows 1.00 across all versions of VBFrontCam, perhaps something is wrong there?)

In any case I thought I would poke this discussion to see if anyone has seen a preview image with the Nexus 7 front camera.:sign0085:
 
Upvote 0

vb1992

Well-Known Member
Licensed User
Longtime User
The versions are correct when you download the ZIP files,
but the version in the library will say 1.0, I will be correcting that.

Make sure you don't have this in your manifest:

<uses-feature android:name="android.hardware.camera.front" android:required="false" />
 
Upvote 0

msawada

Member
Licensed User
Longtime User
Nexus 7 Preview Image issue continues

Thanks very much for the quick reply. No the line is not in the manifest according to the IDE mainfest editor in any case. Is there somewhere else to look for that entry in the mainfest file?

I'm using a stripped down version of the example you created without the menu items. Everything works including the FC.startpreview but nothing shows up on the panel as a preview image, it is blank. Since the front camera front camera doesn't seem to work (it does work with other apps on the play store btw) the fc.takepicture catches the error.

Any other suggestions would be great as my app needs that front camera. It does work great on my Xoom.

Mike
 
Upvote 0

msawada

Member
Licensed User
Longtime User
Nexus 7 Preview Image temporary solution

Hi again, just thought I would share the partial solution I am using, while not what I want, works for now, it is to use Jack Cole's code to open the native camera intent and pass it the file name.

This works on the Nexus 7. Even though there is no native launcher for the camera app on the Nexus 7, it is still there.:sign0163:

Mike
 
Upvote 0

vb1992

Well-Known Member
Licensed User
Longtime User
here is quick code off the top of my head....
might help?

B4X:
Dim FC As CameraFront

   FC.Initialize(Panel1,"FC")
   Panel1.Invalidate
   Activity.Invalidate


 
Sub fc_Ready (Success As Boolean)
   
    
   FC.Rotate90

   Try

         FC.StartPreview
      Panel1.Invalidate
            Activity.Invalidate
   Catch
        Msgbox("FRONT Camera not working?  ","INFO")
   End Try
    
   
    

End Sub
 
Last edited:
Upvote 0

msawada

Member
Licensed User
Longtime User
Nexus 7 Preview Image still not working

Thanks both for the replies. I tried both methods the invalidate and rotating and still no preview image. NJDude, you said that you have it working, can you post the code so I can try exactly what you have to see if it will work with my Nexus 7? I am really vexed and using the external intent right now which works fine but is still not what I want to use.

thanks
Mike:sign0161:
 
Upvote 0

NJDude

Expert
Licensed User
Longtime User
Note that I said it doesn't work on a Nexus 7, the camera is a touchy issue, the libs do not work on certain devices that's not a lib problem but a manufacturers problem, as far as I know, there's no standard API for camera.
 
Upvote 0

msawada

Member
Licensed User
Longtime User
Nexus 7 Preview Image still not working

Thanks NJDude, I misread your description and thought you ad it working. I guess three is no solution to this on the Nexus 7, other than using using exertnal intents as descirbed above.

Mike:icon_clap:
 
Upvote 0
Top