Home>
ANDROIDSTUDIO KOTLIN.
When I wrote the following code, I got an error on the second line.
val imageCapture = ImageCapture (imageCaptureConfig)
findViewById (R.id.capture_button) .setOnClickListener {<<<<<<<<<<<<<<<<<<Error
val file = File (externalMediaDirs.first (),
"${System.currentTimeMillis ()}. Jpg")
imageCapture.takePicture (file, executor,
object: ImageCapture.OnImageSavedListener {
override fun onError (
imageCaptureError: ImageCapture.ImageCaptureError,
The details of the error are as follows.
Type inference failed: Not enough information to infer parameter T in fun<T: View!>findViewById (p0: Int): T!
Please specify it explicitly.</Code></pre>
<p>When I looked into it, the description method for KOTLIN seemed to be different</p>
<p>Reference URL<br />
<p>Because the code has been written again like this</p>
<pre><code>val root = inflater.inflate (R.layout.fragment_camera, container, false)
val textView: TextView = root.findViewById (R.id.text_camera)
I tried the following, but it didn't work.
Error source
findViewById (R.id.capture_button) .setOnClickListener {<<<<<<<<<<<<<<<<<<<<<<Error
The source I tried this time
root.findViewById (R.id.capture_button) .setOnClickListener {<<<<<<<<<<<<<<<<<<<<
<p>This is another source I tried this time.</p>
<pre><code>root.findViewById<Root>(R.id.capture_button) .setOnClickListener {<<<<<<<<<<<<<<<<<&<<</Try>
How can I get an error? We apologize for the trouble.
-
Answer # 1
Related articles
- android - how to make a sound [kotlin]
- android - kotlin: how to perform https communication by referring to the ssl certificate in the terminal
- android - [kotlin] unresolved reference: dialogbuttonclicklistener () cannot be resolved
- android - how to study kotlin
- android studio - [kotlin] there is activity_loginxml, but i get an unresolved reference: activity_login error
- kotlin - i want to conditionally branch list data for android application development and display it in a sorted manner
- kotlin - i want to conditionally branch list data for android application development and display it in a sorted manner
- execution failed for task ': app: compiledebugjavawithjavac' occurs in react-native run-android
- android - about display of kotlin images
- kotlin android implements onclicklistener on acitivity and overrides onclick, but there is no response when clicked
- [kotlin] [android studio] i don't know how to use realm in suspend function
- android - can unity, swift and kotlin coexist?
- Android uses Kotlin to implement multi-node progress bar
- The implementation of Android studio generation with Kotlin documents
- Android Studio kotlin generates editing class comment code
- android - kotlin todo app
- Android Studio video playback failed start called in state1
- Android Studio Kotlin code and java code conversion example
- Android use kotlin to achieve click to change the global language (Chinese-Japanese-English switch)
- android studio - [kotlin app development] i want to make the specifications so that the number of buttons increases each time th
Related questions
- android - i want to make recyclerview compatible with viewbinding
- [android] i want to get an advertisement id for device identification
- where is the defaultrealm when using realm on android stduio?
- android - i want to turn on the camera light
- android - i want to do something (toast, activity transition, etc) at 0:00 on kotlin
- java : Bild error multi-module
- Learning Android. Which language is better for Kotlin or Java perspective and why?
- android : How do I know which button was pressed?
- java : What's the best way to store sockets in an android application?
- java : Data is not displayed in Android widget
Please specify the cast type explicitly.