일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
- 안드로이드 os 구조
- 안드로이드 유닛테스트란
- 큐 자바 코드
- 자바 다형성
- android ar 개발
- 멤버변수
- jvm 작동 원리
- android retrofit login
- 안드로이드 유닛 테스트 예시
- 클래스
- 2022 플러터 설치
- Rxjava Observable
- 스택 자바 코드
- ar vr 차이
- 안드로이드 레트로핏 사용법
- ANR이란
- rxjava disposable
- 스택 큐 차이
- 서비스 쓰레드 차이
- 안드로이드 레트로핏 crud
- jvm이란
- 플러터 설치 2022
- 안드로이드 라이선스 종류
- 서비스 vs 쓰레드
- 안드로이드 유닛 테스트
- 객체
- rxjava hot observable
- 2022 플러터 안드로이드 스튜디오
- rxjava cold observable
- 안드로이드 라이선스
- Today
- Total
목록분류 전체보기 (1025)
나만을 위한 블로그

이 포스팅은 플러터가 어떤 구조인지 샅샅이 파악하려고 쓰는 게 아니다. 대략적으로 어떻게 만들어져 있는지 알아보는 포스팅이다. 포스팅의 바탕이 되는 사이트는 플러터 공식문서다. 너무 깊은 내용을 다루는 듯하거나 상관없어 보이는 내용은 생략했다. https://docs.flutter.dev/resources/architectural-overview Flutter architectural overview A high-level overview of the architecture of Flutter, including the core principles and concepts that form its design. docs.flutter.dev 플러터는 iOS, 안드로이드 같은 OS에서 코드 재사용을 허용하는..

이전 포스팅에서 프래그먼트를 어떻게 구현하는지 간단하게 확인했으니 이제 생명주기를 확인할 차례다. 자체적인 생명주기를 갖기 때문에, 액티비티와 다른 점이 뭔지 생각하면서 보면 좋을 것이다. https://developer.android.com/guide/fragments/lifecycle?hl=ko 프래그먼트 수명 주기 | Android 개발자 | Android Developers 이 페이지는 Cloud Translation API를 통해 번역되었습니다. 프래그먼트 수명 주기 컬렉션을 사용해 정리하기 내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요. 각 Fragment 인스턴스에는 고유한 developer.android.com 각 프래그먼트 인스턴스에는 고유한 생명주기가 있다. 유저가 앱을 탐색하거나..

앱을 만들다 보면 언젠간 액티비티로는 부족하거나 액티비티까지 쓰긴 애매한데 싶은 화면을 구현해야 할 수 있다. 이 때 쓸 수 있는 게 프래그먼트다. 사실 프래그먼트는 DrawerLayout, 뷰페이저, 바텀 시트 등을 구현할 때 요긴하게 사용할 수 있고, 프래그먼트를 써서 구현한 예제들도 검색해보면 심심찮게 볼 수 있다. 뷰페이저의 경우 아예 프래그먼트를 써서 구현한 예시 코드를 제시하는 디벨로퍼 문서도 볼 수 있다. https://developer.android.com/develop/ui/views/animations/screen-slide?hl=ko ViewPager로 프래그먼트 간 슬라이드 | Views | Android Developers 이 페이지는 Cloud Translation API를 통해..

copyOfRange()를 쓰면 비교적 간단하게 풀 수 있다. class Solution { fun solution(arr: IntArray, query: IntArray): IntArray { var result = arr for (i in query.indices) { result = if (i % 2 == 0) { result.copyOfRange(0, query[i] + 1) } else { result.copyOfRange(query[i], result.size) } } return result } }

정수 배열 arr이 주어진다. 배열 안의 2가 모두 포함된 가장 작은 연속된 부분 배열을 리턴하는 함수를 완성하라. arr에 2가 없으면 -1을 리턴한다 2가 있는 첫 인덱스, 마지막 인덱스를 구하고 첫 2부터 마지막 2까지의 숫자들을 리턴하도록 작성해서 풀었다. class Solution { fun solution(arr: IntArray): IntArray { val first = arr.indexOfFirst { it == 2 } val last = arr.indexOfLast { it == 2 } return if (first != -1 && last != -1) { if (arr.slice(first..last).isEmpty()) { intArrayOf(-1) } else { arr.slice..

풀지 못해서 다른 사람의 풀이를 참고했다. class Solution { fun solution(arr: IntArray, intervals: Array): IntArray { val intList = ArrayList() for (i in intervals.indices) { for (j in intervals[i][0]..intervals[i][1]) { intList.add(arr[j]) } } return intList.stream().mapToInt { x: Int? -> x!! }.toArray() } }

정수 리스트 num_list가 주어질 때, 첫 번째로 나오는 음수의 인덱스를 리턴하는 solution 함수를 완성하라. 음수가 없다면 -1을 리턴한다 정수 리스트 안에서 음수를 찾아야 하기 때문에 find를 쓰고 조건을 0보다 작은 것으로 설정할 수 있다. 또한 음수가 없다면 -1을 리턴해야 하기 때문에 아래와 같이 작성할 수 있다. class Solution { fun solution(numList: IntArray): Int { return if (numList.find { it < 0 } != null) { numList.indexOf(numList.find { it < 0 }!!) } else { -1 } } }

n이 1~4인 경우를 when으로 구분해서 풀면 아래와 같다. class Solution { fun solution(n: Int, slicer: IntArray, num_list: IntArray): IntArray { val a = slicer[0] val b = slicer[1] val c = slicer[2] val answer: IntArray when (n) { 1 -> { answer = IntArray(b + 1) for (i in 0..b) { answer[i] = num_list[i] } } 2 -> { answer = IntArray(num_list.size - a) for (i in a until num_list.size) { answer[i - a] = num_list[i] } } ..
코루틴끼리의 통신을 위한 기본적 방법으로 채널 api가 추가됐다. 채널은 송신자, 수신자 수에 제한이 없고 채널로 전송된 모든 값은 단 한 번만 받을 수 있다. 채널은 서로 다른 2개의 인터페이스를 구현한 하나의 인터페이스다. SendChannel : 원소를 보내거나 더하거나 채널을 닫기 위해 사용 ReceiveChannel : 원소를 받거나 꺼낼 때 사용 public interface SendChannel { public suspend fun send(element: E) public fun close(cause: Throwable? = null): Boolean } public interface ReceiveChannel { public suspend fun receive(): E public fun..
CoroutineScope 팩토리 함수 CoroutineScope는 coroutineContext를 유일 프로퍼티로 갖는 인터페이스다. public interface CoroutineScope { public val coroutineContext: CoroutineContext } CoroutineScope 인터페이스를 구현한 클래스를 만들고 내부에서 코루틴 빌더를 직접 호출할 수 있다. import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Job import kotlinx.coroutines.launch import kotlin.coroutines.CoroutineContext class SomeClass: CoroutineScope {..