분류 전체보기

Error

[Android][Error] New Thread 에러 : Only the original thread that created a view hierarchy can touch its views

[상황] 메인 쓰레드가 아닌 새로운 쓰레드에서 로직을 수행 로직 수행 중 UI 변경이 일어나는 코드를 수행 시 에러 발생 [참고 플랫폼] 더보기 1. Android Studio Bumblebee | 2021.1.1 Patch 2 | Runtime version: 11.0.11 2. 실행 Device : 갤럭시 M12(android 12) [에러 내용] android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views. [해결 방법] 메인 쓰레드가 아닌 다른 쓰레드에서 UI 변동이 일어나면 해당 에러를 발생시킨다 이를 위해 UI 변동이 ..

Error

[Android][Error] 초기화 에러 : lateinit property tvLog has not been initialized

[상황] tvLog 란 TextView 객체를 사용할려 했지만 kotlin.UninitializedPropertyAccessException: lateinit property tvLog has not been initialized 에러를 발생함 [참고 플랫폼] 더보기 1. Android Studio Bumblebee | 2021.1.1 Patch 2 | Runtime version: 11.0.11 [에러 내용] kotlin.UninitializedPropertyAccessException: lateinit property tvLog has not been initialized [해결 방법] 해당 에러는 아주 간단한 에러인데 lateinit 을 붙인 변수를 초기화를 시켜주지 않으니 해당 property가 ..

Android/Kotlin

[Android][Kotlin] 알람매니저(AlarmManager)를 이용한 알림(Notification) 호출하기

특정 시간, 날짜 등 시간을 기준으로 하여 알림을 울리는 작업을 하고자 한다 사실 AlarmManager 만 있는건 아니지만 도즈모드의 문제 때문에 AlarmManager 를 선택했다 도즈모드에 대해서는 아래 android 공식문서에서 확인 하면 될 듯 싶다 https://developer.android.com/training/monitoring-device-state/doze-standby 잠자기 및 앱 대기 모드에 맞게 최적화 | Android 개발자 | Android Developers 앱에서 Android 6.0의 절전 기능을 테스트하고 최적화합니다. developer.android.com 이번에는 사용자가 특정 날짜를 기입함으로써 기입한 날짜에 알림을 울리게 해봤다 BroadcastReceive..

Android/Kotlin

[Android][Kotlin] 알림(Notification) 생성, 호출하기

특정 버튼을 누름으로써 알림을 생성하는 작업을 하고자 한다 알림의 경우 매우 기초적인 방법을 사용하였고, 지금은 특정 버튼 이지만 사용처에 따라 특정 이벤트, 상황에 따라 적용하면 될 것 같다 코드 1 : MainActivity.kt class MainActivity : AppCompatActivity() { private lateinit var notificationManager: NotificationManager private lateinit var bNotiCall: Button override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_ma..

Android/Kotlin

[Android][Kotlin] 캘린더(CalendarView) 생성, 오늘 날짜, 클릭 이벤트

안드로이드에서는 기본적으로 제공하는 캘린더가 있으며, 이번 글은 제공하는 캘린더의 오늘 날짜로 이동, 선택된 날짜 가져오기(날짜 클릭 시 이벤트) 버튼을 새로 만들고 이벤트를 걸어 작업한다 코드 1 : MainActivity.kt 이번 코드에는 주의할 점이 있는데, 첫번째로 캘린더 날짜의 경우 가져올 때 클릭 이벤트를 작성해 특정 변수에 저장 해야 하는것과 두번째로 캘린더의 '월' 의 경우 '+1' 을 해줘야 하는것 세번째로 캘린더의 날짜를 강제로 수정 할 경우 캘린더 클릭 이벤트가 작동하지 않으니 주의해야 하는점이 있다 class MainActivity : AppCompatActivity() { private lateinit var calendarView: CalendarView private late..

자판을 두드리다
'분류 전체보기' 카테고리의 글 목록 (2 Page)
728x90