# Opening camera in kotlin activity issue

**URL:** <https://discuss.kotlinlang.org/t/opening-camera-in-kotlin-activity-issue/2923>\
**Category:** Android\
**Created:** [May 27, 2017, 5:37am UTC](https://discuss.kotlinlang.org/t/opening-camera-in-kotlin-activity-issue/2923 "2017-05-27T05:37:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![adnanali.ozitech](https://avatars.discourse-cdn.com/v4/letter/a/e36b37/32.png) [@adnanali.ozitech](https://discuss.kotlinlang.org/u/adnanali.ozitech)\
**Post date:** [May 27, 2017, 5:37am UTC](https://discuss.kotlinlang.org/t/opening-camera-in-kotlin-activity-issue/2923/1 "2017-05-27T05:37:33Z")

</div>

**Try to open camera in Kotlin android app:**  
But throws exception **could not connect to camera service**

Exactly the same code open camera in android (Java) but not in android(Kotlin)

- Is there something different for camera handling in kotlin
- I have already added permission to android manifest for camera, also runtime permission.
- 

```
         **try {**
             **mCamera = Camera.open(camIdx)**
           **} catch (e2: RuntimeException) {**
             **return**
         }

```
