코틀린 4

[Android] Kotlin Retrofit2 사용법

배운지는 꽤 됐지만 다시 복습삼아 Retrofit2 내용을 정리해보려한다. 사용 방법은 https://square.github.io/retrofit/ Retrofit A type-safe HTTP client for Android and Java square.github.io 여기에 나와있지만, 난 영어를 보고 저걸 이해할 수가 없었다. -ChatGPT Kotlin Retrofit2란, 안드로이드 앱에서 서버와의 통신을 쉽게 처리하기 위한 라이브러리이다. Retrofit2는 Square사에서 개발한 HTTP 클라이언트 라이브러리로, RESTful API와의 통신을 단순화하고 추상화하는 기능을 제공한다. Retrofit2의 핵심 개념 중 하나는 인터페이스 기반의 API 정의입니다. 개발자는 서버의 엔드포인..

Android 2023.05.31

[Android] Kotlin Context 란 ?

Kotlin 개발을 하다보면 Context를 인자로 주는 경우가 많다. 지금까지는 this, requireContext(), context as MainActivity 등 아무거나 넣어보고 작동이 되는걸로 사용만 하고, 제대로된 이해를 하지 못했다. 그래서 이번 기회에 완벽히 이해하고 넘어가고자 한다. 첫번째로 Android Developer 공식 문서를 보면 Interface to global information about an application environment. This is an abstract class whose implementation is provided by the Android system. It allows access to application-specific resour..

Android 2023.05.31

[Android] 안드로이드 스튜디오 터미널 실행 안될 경우

Cannot open Local Terminal Failed to start [powershell.exe] in C:\.................... See IDE log (Help | Show Log in Explorer) for the details. 터미널에 이런 에러가 뜨고 터미널 실행이 안될 경우 AndroidStudio -> File 메뉴 -> Settings 에서 terminal 검색한 후 Shell path를 C:\Windows\System32\cmd.exe 로 변경 이후 터미널을 실행해보면 정상적으로 작동하는 것을 볼 수 있다.

Android 2023.05.29

[Android] Fragment 에서 뜬금없는 unresolved reference 에러 해결

Fragment에서 메모장 앱 작업 중 갑자기 context와 viewLifecycleOwner 부분에서 뜬금없는 unresolved reference Error가 발생하였다. 이건 lifecycle의 어느 부분에서 잘못되었다고 생각되어 gradle파일에 lifecycle 의 모든 종속성을 확인하고, Fragment파일에서 lifecycle부분의 import 를 모두 확인하였는데 이유를 찾지 못했다. 결론은 lifecycle에 관한 에러가 아닌 Fragment를 가져오는 class에 대한 오류였다. 기존의 fragment import 는 이러했다. import android.app.Fragment 이것을 import androidx.fragment.app.Fragment 이렇게 고치니 모든 unresol..

Android 2023.05.29
반응형