• 4
name

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191

Backtrace:

File: /home/prodcxja/public_html/questions/application/views/question.php
Line: 191
Function: _error_handler

File: /home/prodcxja/public_html/questions/application/controllers/Questions.php
Line: 433
Function: view

File: /home/prodcxja/public_html/questions/index.php
Line: 315
Function: require_once

I have copied/created the code below as per the camerakit docs. but when I press the button, nothing happens!

I am using v1.0.0 beta 3.11 version. The docs section only provides basic info and not detailed example with settings, unless I am reading the wrong page.

package com.example.eg

import android.support.v7.app.AppCompatActivity
import com.example.eg.R
import android.os.Bundle
import android.util.Log
import com.camerakit.CameraKitView
import java.io.FileOutputStream
import android.widget.Toast
import com.camerakit.CameraKit
import kotlinx.android.synthetic.main.activity_camera.*

class Camera_Activity : AppCompatActivity() {
    private lateinit var cameraKitView: CameraKitView

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_camera)
        cameraKitView = findViewById<CameraKitView>(R.id.camera)

        cameraKitView.requestPermissions(this) // I have permission="camera" in xml

        val filePath = intent.getStringExtra("path")
        cameraSettings()

        cameraKitView.errorListener = CameraKitView.ErrorListener { cameraKitView, e ->
            Toast.makeText(this,"Camera error!",Toast.LENGTH_SHORT).show()
        }

        button.setOnClickListener {
            cameraKitView.captureImage(object:CameraKitView.ImageCallback {
                override fun onImage(p0: CameraKitView?, p1: ByteArray?) {
// Code never reaches here
if (LOG_ENABLED) Log.e("Picture taken?: ","YES--------")
                    val outputStream = FileOutputStream(filePath)
                    outputStream.write(p1)
                    outputStream.close()
                    finish()

                }
            })
        }
    }


    override fun onStart() {
        super.onStart()
        cameraKitView.onStart()
    }
    override fun onResume() {
        super.onResume()
        cameraKitView.onResume()
    }
    override fun onPause() {
        cameraKitView.onPause()
        super.onPause()
    }
    override fun onStop() {
        cameraKitView.onStop()
        super.onStop()
    }
    override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<String>, grantResults: IntArray) {
        super.onRequestPermissionsResult(requestCode, permissions, grantResults)
        cameraKitView.onRequestPermissionsResult(requestCode, permissions, grantResults)
    }

    private fun cameraSettings(){
        //OPTIONS BELOW: back, FACING_BACK front, FACING_FRONT
        cameraKitView.setFacing(CameraKit.FACING_BACK)
        //cameraKitView.toggleFacing()
        cameraKitView.imageMegaPixels = 1f //1 megapixel

        //OPTIONS BELOW: off, FLASH_OFF on, FLASH_ON
        //cameraKitView.setFlash(CameraKit.FLASH_OFF)
        //OPTIONS BELOW: auto, FOCUS_AUTO continuous, FOCUS_CONTINUOUS off, FOCUS_OFF
        cameraKitView.setFocus(CameraKit.FOCUS_AUTO)
        //OPTIONS BELOW: camera all audio location storage none
        //cameraKitView.setPermissions()
    }


}

My manifest file has camera and write external storage permissions and I know the external storage permission works because of other activities being able to do it without problem.

While I am at it I would like to request a source of information where this camerakit api is explained in detail so not only experts can understand it but junior level people can also have a go at it.