Android Question How do I get FPS on Camera Preview?

Reminisce

Active Member
Snippet:
Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("main")
   
       
    Dim rp As RuntimePermissions
    rp.CheckAndRequest(rp.PERMISSION_WRITE_EXTERNAL_STORAGE)
    rp.CheckAndRequest(rp.PERMISSION_CAMERA)
    rp.CheckAndRequest(rp.PERMISSION_RECORD_AUDIO)
    rp.CheckAndRequest(rp.PERMISSION_READ_EXTERNAL_STORAGE)
    rp.CheckAndRequest(rp.PERMISSION_WRITE_EXTERNAL_STORAGE)
    Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
    If Not(Result) Then
        ExitApplication
        Return
    End If
   
       
    If FirstTime Then
        CameraView1.Initialize2(pnlCamOne,"cameraview1",0)
    End If



End Sub




Sub CameraView1_Ready (Success As Boolean)
    If Success Then
        camOneActive = True
        CameraView1.StartPreview
        txtCamOne.Text = "Active"
        'I want to log current FPS to textview
    Else
        ToastMessageShow("Cannot open camera.", True)
    End If
End Sub

I know android has deprecated the Camera Class and Camera2 is what I should use, but this is just for learning purposes, thanks.
 
Last edited:

Reminisce

Active Member
1. Camera is not deprecated.
2. Your code is wrong. It doesn't handle the permissions correctly.


You can call CamEx.GetPreviewFpsRange to get the FPS range.
Thank you @Erel for exactly what I needed. I am learning how to use the java object well. I am aware of my permission error, it is a test project and I am practising.​
 
Upvote 0

Reminisce

Active Member
Thank you @Erel for exactly what I needed. I am learning how to use the java object well. I am aware of my permission error, it is a test project and I am practising.​
There is no need for the other threads I created, this has solved everything. I was able to look at the class and understood it. I didn't know how to getParameters, I see you created a map-like object there. Thanks.:)
 
Upvote 0

Similar Threads

Top