Android App Development: Difference between revisions

From David's Wiki
Created page with "Notes on Android App development ==Camera 2 API== ===Getting Started=== <pre> val cameraManager = getSystemService(Context.CAMERA_SERVICE) as CameraManager try { val cam..."
 
Line 4: Line 4:
==Camera 2 API==
==Camera 2 API==
===Getting Started===
===Getting Started===
<pre>
<syntaxhighlight lang="kotlin">
val cameraManager = getSystemService(Context.CAMERA_SERVICE) as CameraManager
val cameraManager = getSystemService(Context.CAMERA_SERVICE) as CameraManager
try {
try {
Line 21: Line 21:
     println("An exception occurred")
     println("An exception occurred")
}
}
</pre>
</syntaxhighlight>


==Resources==
==Resources==

Revision as of 21:01, 10 April 2020

Notes on Android App development


Camera 2 API

Getting Started

val cameraManager = getSystemService(Context.CAMERA_SERVICE) as CameraManager
try {
    val cameraIds = manager.cameraIdList
    for (id in cameraIds) {
        println("Found camera id " + id)
        val charac = manager.getCameraCharacteristics(id)
        val capabilities = charac.get(CameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES);
        for (capability in capabilities) {
            if (capability == CameraMetadata.REQUEST_AVAILABLE_CAPABILITIES_DEPTH_OUTPUT) {
                println("Depth is available);
            }
       }
   }
} catch ( e : Exception) {
    println("An exception occurred")
}

Resources