[Kotlin][deep copy] 리스트의 마지막 원소가 사라져 버렸다.

Kotlin 코드에서 deep copy 를 하지 않은 채 원본을 clear 하니까 리스트의 마지막 원소가 사라지는 문제가 발생했다. 리스트의 마지막 원소만 사라진다. val testList: MutableList<Int> val listOfTestList: MutableList<List<Int>> .forEach 블록 내에서 testList 를 몇 개 생성하면서 listOfTestList 에 추가하였다: listOfTestList.add(testList) 나중에 listOfTestList 를 출력해 보니 감쪽같이 마지막 원소만 사라졌다. 마지막 element 가 [] 이렇게 빈 채로 … 더 읽기

[해결]error.NonExistentClass: Hilt 로 ViewModel 에 Proto DataStore 인스턴스 전달할 때

Proto DataStore 에 Hilt 를 적용할 때 컴파일 오류가 발생하여 해결한 방법을 공유한다. Hilt + Proto DataStore + ViewModel 에서 문제 발생 지난 글에서 build.gradle.kts 를 공개한 이후 Proto DataStore 를 익혔다(지난 글: https://hhtt.kr/103026). 그런데 코드에 ViewModel Factory 를 이용해서 DataStore 인스턴스를 ViewModel 에 넣어주도록 되어 있어서 Hilt 로 주입하도록 바꾸려고 했다. 이 때, Preferences … 더 읽기

[Attachment] build.gradle.kts for Compose + Retrofit + KSP + Room + Hilt

In order to apply Hilt to my project, I modified build.gradle.kts and updated Compose, Retrofit, KSP, Room, Hilt, etc. to the latest. Both build.gradle.kts are provided in an attachment. Korean version of this posting: https://hhtt.kr/103026 I decided to use Hilt. After struggling for over a day to apply HIlt to my project, I succeeded the … 더 읽기

[첨부] build.gradle.kts for Compose + Retrofit + KSP + Room + Hilt

프로젝트에 Hilt 를 적용하기 위해서 build.gradle.kts 를 수정하고, 내친김에 Compose, Retrofit, KSP, Room, Hilt 등을 최신으로 판올림하였다. 두 build.gradle.kts 를 첨부 파일로 제공한다. Korean version of this posting: https://hhtt.kr/103039 Hilt 를 사용하기로 했다. 내 프로젝트에 HIlt 를 적용하기 위해서 하루 넘게 씨름을 하다가 그저께 저녁에 성공했다. 내가 목표한 것은, container 에 담긴 채 ViewModel Factory … 더 읽기

Jetpack Compose, how to force recomposition manually

There are times when Jetpack Compose does not allow necessary recomposition right away. In this case, let’s find out how to force immediate recomposition manually. I changed the state value, but why doesn’t the button appear? What I wanted was for when I press a button, another button would appear somewhere else. I thought the … 더 읽기

Jetpack Compose, 수동으로 recompose 하는 방법

내가 원하는데 Jetpack Compose 가 바로 recompose 해주지 않을 때가 있다. 이 때 수동으로 즉시 recompose 되게 하는 방법을 알아본다. 상태값을 바꿨는데 왜 단추가 안 나타나는 거지? 내가 원했던 것은, 내가 어떤 단추를 눌렀을 때 다른 곳에 다른 단추가 나타나게 하는 거였다. 논리는 맞다고 생각했는데 단추는 나타나지 않았다. 혹시나 해서 화면을 옆으로 돌려 보았다. 그러자 … 더 읽기

전기레인지(하이라이트) 2구 GM202 대체품 웰치 리안츠 LH-202 직접 교체 설치함

2구짜리 전기레인지 GM202 상판이 파손되었는데 같은 제품을 살 데가 없었다. 다행히 거의 비슷한 규격의 대체품 웰치 리안츠 LH-202 를 찾아서 주문하여 직접 교체 설치하였다. 전기레인지(하이라이트) 2구 GM202 상판이 깨졌다. 어머니가 쓰는 전기레인지 상판이 깨졌다. 상판에 Grand Master GM202 라고 적혀 있다. 이 제품을 살 수 있는지, 예전에 검색해 본 적이 있었다. 아무리 검색해 보아도 파는 … 더 읽기

안드로이드 프로젝트 디렉터리 이름에 쉼표가 있으면?

잘 실행되던 안드로이드 프로젝트를 복사하여 새 프로젝트를 만들어서 이를 실행하였는데 처음 보는 오류가 발생하였다. 디렉터리(폴더) 이름에 쉼표가 있으면 어떤 문제가 생기는지 알아본다. 안드로이드 프로젝트 복사본 만들기 지난 두어 달 앱 개발 공부를 하면서 이런저런 오류를 많이 경험하였다. 이번에는 또 다른 오류가 등장했다. 프로젝트 코드에 중요한 변화가 생길 시점이 되면 나는 습관적으로 복사본을 만들어서 새 프로젝트를 … 더 읽기

Galaxy S9, green horizontal stripes at the top, a temporary solution to the screen not working issue

Even when I turned on the Samsung Galaxy S9 screen, only a green horizontal stripe appeared at the top, and other than that, it was dark and I couldn’t see anything. I found that using the Always On Display feature in the Lock screen settings normalized the screen. A screen issue occurred with the Galaxy … 더 읽기