diff --git a/examples/hand_landmarker/android/app/src/main/java/com/google/mediapipe/examples/handlandmarker/fragment/CameraFragment.kt b/examples/hand_landmarker/android/app/src/main/java/com/google/mediapipe/examples/handlandmarker/fragment/CameraFragment.kt index c21079759d..6fa0c2a955 100644 --- a/examples/hand_landmarker/android/app/src/main/java/com/google/mediapipe/examples/handlandmarker/fragment/CameraFragment.kt +++ b/examples/hand_landmarker/android/app/src/main/java/com/google/mediapipe/examples/handlandmarker/fragment/CameraFragment.kt @@ -246,8 +246,12 @@ class CameraFragment : Fragment(), HandLandmarkerHelper.LandmarkerListener { override fun onItemSelected( p0: AdapterView<*>?, p1: View?, p2: Int, p3: Long ) { - handLandmarkerHelper.currentDelegate = p2 - updateControlsUi() + try { + handLandmarkerHelper.currentDelegate = p2 + updateControlsUi() + } catch(e: UninitializedPropertyAccessException) { + Log.e(TAG, "HandLandmarkerHelper has not been initialized yet.") + } } override fun onNothingSelected(p0: AdapterView<*>?) {