Android프로그래밍/오늘의 공부8 [Kotlin] findViewById 전역변수 선언시 오류의 원인 전역변수 findViewById 오류 대처법 다음과 같이 전역변수를 선언하고 findViewById로 초기화를 하면 오류가 발생합니다. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 package com.example.exam01 class List_view : AppCompatActivity() { val lsit_view = findViewById(R.id.list_view) val button: Button=findViewById(R.id.ok_button) override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) } Colored by Color Scripter cs 해당위치에서는 아직.. 2021. 2. 3. 01. 안드로이드 View접근이 안될때 / view import가 안될때 Android Studio 그리고 kotlin-android-extensions Plugin 기존 안드로이드 스튜디오에서 View를 조작할 때 XML을 소스코드로 import하여 View를 쉽게 조작 할 수 있었다 Kotlin-android-extensions 라는 플러그인덕분인데 안드로이드 스튜디오 4.1버전부터 해당기능을 디폴트로 지원하지 않는다 플러그인이 Kotlin의 View Binding 기능과 겹치는 부분이 있기 때문인데 2021년에는 해당 플러그인을 완전히 삭제할 계획이라고 한다. 자세한 사항은 다음 문서를 참고 android-developers.googleblog.com/2020/11/the-future-of-kotlin-android-extensions.html The future of .. 2020. 12. 23. 이전 1 2 3 다음