Android App Development: Difference between revisions
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..." |
|||
(7 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
Notes on Android App development | Notes on Android App development | ||
See https://developer.android.com/get-started | |||
==Architecture== | |||
Android apps are made of Activities https://developer.android.com/reference/android/app/Activity | |||
For native Android apps, there are two current approaches to building out the UI: | |||
* Traditional Android apps are made using views were the layout is stored in an XML file and each component is a view with it's own class. | |||
* Compose apps are made using Jetpack Compose. Compose components are functions similar to React functional components. | |||
==Views== | |||
==Compose== | |||
==AGSL Shaders== | |||
See https://developer.android.com/develop/ui/views/graphics/agsl | |||
==Camera 2 API== | ==Camera 2 API== | ||
===Getting Started=== | ===Getting Started=== | ||
< | <syntaxhighlight lang="kotlin"> | ||
val cameraManager = getSystemService(Context.CAMERA_SERVICE) as CameraManager | val cameraManager = getSystemService(Context.CAMERA_SERVICE) as CameraManager | ||
try { | try { | ||
Line 11: | Line 26: | ||
println("Found camera id " + id) | println("Found camera id " + id) | ||
val charac = manager.getCameraCharacteristics(id) | val charac = manager.getCameraCharacteristics(id) | ||
val capabilities = charac.get(CameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES) | val capabilities = charac.get(CameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES) | ||
for (capability in capabilities) { | for (capability in capabilities) { | ||
if (capability == CameraMetadata.REQUEST_AVAILABLE_CAPABILITIES_DEPTH_OUTPUT) { | if (capability == CameraMetadata.REQUEST_AVAILABLE_CAPABILITIES_DEPTH_OUTPUT) { | ||
println("Depth is available); | println("Depth is available"); | ||
} | } | ||
} | } | ||
} | } | ||
} catch ( e : Exception) { | } catch (e : Exception) { | ||
println("An exception occurred") | println("An exception occurred") | ||
} | } | ||
</ | </syntaxhighlight> | ||
==Resources== | ==Resources== |
Latest revision as of 04:14, 1 May 2025
Notes on Android App development
See https://developer.android.com/get-started
Architecture
Android apps are made of Activities https://developer.android.com/reference/android/app/Activity
For native Android apps, there are two current approaches to building out the UI:
- Traditional Android apps are made using views were the layout is stored in an XML file and each component is a view with it's own class.
- Compose apps are made using Jetpack Compose. Compose components are functions similar to React functional components.
Views
Compose
AGSL Shaders
See https://developer.android.com/develop/ui/views/graphics/agsl
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")
}