2020/10 20

안드로이드 스튜디오 개발 시 람다 표현식 안 먹힐 때,

한 번도 그런적이 없었는데.. 오늘 갑자기 아래와 비슷하게 람다가 안 먹힌다.. 그럼 아래처럼 compileOptions를 추가해 주거나, android { defaultConfig { ... } compileOptions { targetCompatibility 1.8 sourceCompatibility 1.8 } } Project Structure에서 targetCompatibility, sourceCompatibility 를 Java 8 이상으로 설정하면 됩니다. 둘 중에 하나만 하면 나머지는 자동 반영 됩니다. 출처 : fluorite94.tistory.com/85 breakcoding.tistory.com/196

오늘 인터뷰 한 녹음을 들어봤다..

오늘 Tech screening 인터뷰가 있어서... 나중에 참고하려고 내 목소리를 녹음 했다. 뭐라고 하는지 들어보자... .... 토나오는데..ㅠㅠ 못 듣겠는데..ㅠㅠㅠㅠ ㅅㅂ 내가 영어를 이렇게 하는구나... 와... ㅅㅂ..ㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠ 다시 들어봐도.. 토나와서 더 듣기 힘들다..-ㅠ-

오늘하루 2020.10.23

Pair Class가 없네??

Oracle java sdk에는 선언이 되어 있다는데.. 이 클래스가 없어서.. 굳이 sdk 버전을 바꾸고 싶지 않으면 아래 클래스를 추가 해서 사용하면 됩니다. public class Pair { private final K element0; private final V element1; public static Pair createPair(K element0, V element1) { return new Pair(element0, element1); } public Pair(K element0, V element1) { this.element0 = element0; this.element1 = element1; } public K getElement0() { return element0; } publ..

JVM에서 메모리 릭 정의

정의 : abandoned objects but still accessible(버려진 오브젝트지만 접근이 가능한 경우) 메모리 릭이 자주 발생하는 코드(아래 영상에서 발취함) Static variables Singleton classes that are holding onto your calss Registering yourself with a listener, but forgetting to remove it Any of these inner classes that for some reason may not end up stopping 발취 영상 : Deep Dive into Android Studio Profilers (Android Dev Summit '18) https://youtu.be/LGVb..

Android Profiler 사용법 & JVM에서 메모리 릭 정의

아래 영상들을 순서 대로 보면 어떻게 사용하는지 알게 될 겁니다. 영어를 모르시면 유튜브 자동 번역으로 보세요..(갓튜브..) 매우 간단한 사용법 https://youtu.be/FxDa2td6Ej8 실제 어떻게 사용하는지 예시 프로젝트로 알려줌 https://youtu.be/4Wnu_2meZaI 자세히 알려줌 Deep Dive into Android Studio Profilers (Android Dev Summit '18) https://youtu.be/LGVbpobV-Yg Demystify the data in Android Studio Profilers (Android Dev Summit '19) https://youtu.be/v4kCRZ_O4Lc network profiler 사용법 youtu.be..

매우 간결하고 파워풀한 RxJava 이벤트 버스(Super simple event bus with RxJava and Kotlin)

싱글톤으로 아래를 선언하고, main 처럼 사용하면 됩니다. 장점은 클래스 타입에 따라서 event가 발생하게 되므로 데이터 클래스 관련 처리를 callback처럼 사용할 수 있습니다. 예를 들어, thread1 에서 서버나 db 데이터를 가져 오고 그것을 mainthread로 가져 오려고 할 때, publish()를 사용하면 adapter에 데이터를 가공 후 바로 저장할 수 있습니다. 특히.. 서버나 db에서 데이터를 가져 올 때, 몇 개를 가져 오는지 알 수 없어서 항목을 하나씩 업데이트 해야 할 때 좋을 것 같습니다. import io.reactivex.Observable import io.reactivex.subjects.PublishSubject // 혹은 implementation "io.re..

Android Room 사용시 필요한 libraries

아래 설정을 안했더니 이상한 에러가 나면서 컴파일 자체가 안된다.. 구글신에게 물어 봐서 알게 됨 build.gradle 최상단에 apply plugin: "kotlin-kapt" dependencies에는 dependencies{ ... implementation "androidx.room:room-runtime:2.2.5" kapt "android.arch.persistence.room:compiler:1.1.1" implementation "android.arch.persistence.room:rxjava2:2.2.5" // room 하고 rxjava를 같이 쓰려면 필요 } 출처 : stackoverflow.com/questions/46665621/android-room-persistent-appd..

Android Room annotation 정리(어노테이션)

안드로이드 앱에서 SQLite 데이터베이스를 쉽고 편리하게 사용할 수 있도록 하는 기능이다. SQLite 위에 만든 구글의 ORM(Object-relational mapping)이다. 룸을 사용하면 앱의 단일 정보 소스로 제공되는 캐시를 통해 인터넷 연결 여부와 관계없이 앱에 있는 주요 정보의 일관된 사본을 볼 수 있다. 룸의 구성요소는 Database, Entity, DAO 이다. Database // 데이터 베이스에서 사용하는 엔티티와 버전을 지정합니다. @Database(entities = [User::class], version = 1) abstract class UserDatabase : RoomDatabase() { // 데이터베이스와 연결할 데이터 접근 객체를 정의합니다. abstract f..

Volatile in Kotlin

@Volatile var tmpEndedAt: Long? = null 이렇게 사용하면 됩니다. Volatile이 뭔지 모르신다면,,, 무시 하셔도 됩니다.-0-;; ..... 아니면.. 아래 참고를 보세요. Volatile 참고 : blog.naver.com/PostView.nhn?blogId=classic2u&logNo=50003118713&parentCategoryNo=&categoryNo=15&viewDate=&isShowPopularPosts=false&from=postView m.blog.naver.com/PostView.nhn?blogId=kyed203&logNo=220053808209&proxyReferer=https:%2F%2Fwww.google.com%2F 출처 : stackoverflo..