본문 바로가기
728x90

Android/개념 및 정보11

[Android 12] Preview of Android 12 Android 12 업데이트 내용 https://android-developers.googleblog.com/2021/02/android-12-dp1.html?m=1 First preview of Android 12 Posted by Dave Burke, VP of Engineering Every day, Android apps help billions of people work, play, communicate, and create on a wi... android-developers.googleblog.com Compatible media transcoding https://developer.android.com/about/versions/12/features/compatible-media-trans.. 2021. 2. 19.
[Android] MVVM 의 ViewModel (using LiveData) 안드로이드 아키텍처 중 가장 많이 쓰이는 MVVM 구조에서 VM의 역할을 해주는 ViewModel에 대해서 스터디하였습니다. 결과물 버튼을 클릭하면 카운트가 올라가고 가로로 전환 시에도 데이터가 변화하지 않는 것을 확인할 수 있는 간단한 앱입니다. 안드로이드는 회전 이벤트가 주어지면 데이터가 사라집니다. 이전에는 bundle을 이용해 onPause() 이벤트에 데이터를 저장하고 다시 onResume()이 되면 bundle로 데이터를 불러왔습니다. 그러나 ViewModel을 이용하면 bundle을 이용하지 않아도 데이터를 유지할 수 있습니다. 프로젝트 생성 먼저 새로운 프로젝트부터 생성해보겠습니다. 저는 Exam_ViewModel 이름으로 생성하였습니다. Gradle build.gradle(Moduel: .. 2020. 12. 31.
[Android] Hilt 의존성 주입(DI) gradle 버전, 각 어노테이션 설명 gradle.build(project) buildscript { ext.kotlin_version = '1.3.72' ext.hilt_version = '2.28-alpha' repositories { google() jcenter() } dependencies { classpath 'com.android.tools.build:gradle:4.0.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "com.google.dagger:hilt-android-gradle-plugin:$hilt_version" } } gradle.build(module) . . . apply plugin: 'kotlin-kapt' .. 2020. 12. 11.
[Context] Fragment 에서 context 와 requireContext context /** * Return the {@link Context} this fragment is currently associated with. * * @see #requireContext() */ @Nullable public Context getContext() { return mHost == null ? null : mHost.getContext(); } requireContext /** * Return the {@link Context} this fragment is currently associated with. * * @throws IllegalStateException if not currently associated with a context. * @see #getContext() .. 2020. 12. 10.
728x90