본문 바로가기 메뉴 바로가기

개발 노트

프로필사진
  • 글쓰기
  • 관리
  • 태그
  • 방명록
  • RSS

개발 노트

검색하기 폼
  • 분류 전체보기 (65)
    • android (38)
    • linux (4)
    • React Native (8)
    • Mongo DB (2)
    • Mac (1)
    • javascript (1)
    • algorithm (1)
    • kotlin (7)
  • 방명록

android (38)
di 패턴, dagger, hilt

Dependency injection이란? 정의 : 의존성 주입의 줄임말 요약 : 필요로 하는 의존성을 외부(생성자, 파라미터 등)에서 전달받는것 안하면 안좋은 점 : 코드의 유연성과 확장성이 떨어짐 또한 기능 및 코드 변경 할 때 많은 코드를 수정해야 함 하면 좋은 점 : 안좋은점의 반대, + 테스트 코드 작성에 용이함 dagger 예제 1. @Component interface정의 2. 의존성 주입할 module 정의 3. 데이터 가져올 ApiService 정의 4. 의존성 주입 * DaggerAppComponent는 Dagger lib에서 자동으로 생성되며, 이름 규칙은 "{Dagger$@ComponentInterfaceName} --------------------------------------..

android 2023. 4. 4. 18:06
system screen rotate click listener

private val autoRotateObserver = AutoRotateObserver(this, listener) contentResolver.registerContentObserver( Settings.System.getUriFor(Settings.System.ACCELEROMETER_ROTATION), true, autoRotateObserver ) override fun onDestroy() { super.onDestroy() contentResolver.unregisterContentObserver(autoRotateObserver) } class AutoRotateObserver(context: Context, listener: RotateConfigEventListener) : Cont..

android 2023. 3. 7. 18:09
retrofit으로, rx and coroutine

class MainViewModel(val app: Application) : AndroidViewModel(app) { val tagtag = "tag@" val retrofit: RetrofitApi = RetrofitBuilder.getApiService("https://api.bithumb.com/") init { initCoinRx() initCoinCoroutine() } @SuppressLint("CheckResult") fun initCoinRx() { retrofit.getCoinInfoRx("BTC") .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe { coin -> Log.d(tagt..

android 2023. 2. 3. 15:23
android mvvm 예제

본 예제에 model 부분은 없습니다. data 관련 핸들링은 모두 model에서 해야하고, viewmodel에선 view에 로직만 담당합니다. databinding, kotlin을 사용합니다. 사용 파일들은 아래와 같습니다. * AActivity.kt * A1Viewmodel.kt * A2Viewmodel.kt * a_activity.xml * a1_viewmodel.xml * a2_viewmodel.xml 1. AActivity.kt class AActivity :AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) DataBindingUtil.setConte..

android 2023. 1. 30. 10:17
retrofit

import okhttp3.OkHttpClient import okhttp3.logging.HttpLoggingInterceptor import retrofit2.Retrofit import retrofit2.converter.gson.GsonConverterFactory object RetrofitBuilder { private fun getRetrofit():Retrofit { val httpLoggingInterceptor = HttpLoggingInterceptor() httpLoggingInterceptor.level = HttpLoggingInterceptor.Level.BODY val client = OkHttpClient.Builder(). addInterceptor(httpLoggingI..

android 2022. 9. 21. 14:10
by viewmodels() 쓰는법,

private lateinit var vm: MainViewModel vm = ViewModelProvider(this).get(MainViewModel::class.java) 원래 이렇게 써야 하는데 kotlinOptions { jvmTarget = "1.8" } implementation 'androidx.activity:activity-ktx:1.1.0' implementation 'androidx.fragment:fragment-ktx:1.2.5' 이거 하면 private val vm: MainViewModel by viewModels() 이렇게 사용 가능

android 2022. 8. 18. 17:43
android Frame Animation, Animation Drawable 사용 방법

2가지 방법, 1. xml 사용 한 구현 방법 1). xml 생성 res\drawable\ 안에 xml 생성 2). imageView에 위에서 생성한 animation src로 적용 3). activity java 로 구현 ImageView animation = findViewById(R.id.imsi_animation); AnimationDrawable animationDrawable = (AnimationDrawable) imsi_animation.getDrawable(); animationDrawable.start(); -----------------------------------------------------------------------------------------------------..

android 2020. 4. 27. 10:22
AnimationDrawable memory 문제.

AnimationDrawable 사용 시 메모리 해제가 되지 않는 이슈 생명주기에 따라 아래 코드를 호출. animationDrawable.stop(); for (int i = 0; i < animationDrawable.getNumberOfFrames(); ++i){ Drawable frame = animationDrawable.getFrame(i); if (frame instanceof BitmapDrawable) { ((BitmapDrawable)frame).getBitmap().recycle(); } frame.setCallback(null); } animationDrawable.setCallback(null); Heap Alloc 과 Heap Free에 대한 내용은 좀 더 공부가 필요할 듯 하지..

android 2020. 4. 27. 10:09
안드로이드 SurfaceView Video 예제

* xml * activity onCreate mSurfaceView1 = (SurfaceView)findViewById(R.id.surfaceView1); mSurfaceHolder1 = mSurfaceView1.getHolder(); mMediaPlayer1 = new MediaPlayer(); mSurfaceHolder1.addCallback(new SurfaceHolder.Callback() { @Override public void surfaceCreated(SurfaceHolder holder) { mMediaPlayer1.setDisplay(holder); } @Override public void surfaceChanged(SurfaceHolder holder, int format, int..

android 2020. 1. 31. 17:12
ExoPlayer 사용 법.

exoPlayer 장점 - 빠르다. 버벅임이 적다. 가볍다 등등. MediaPlayer보다 훨신 기능도 많고 좋은것 같음. 실제 상용 프로젝트에선 MediaPlayer를 사용한 SurfaceView보다 ExoPlayer가 훨신 좋아보임.. 타겟 환경 compileSdkVersion 22 buildToolsVersion "28.0.3" minSdkVersion 17 * build.gradle(Module:app) - android compileOptions { sourceCompatibility 1.8 targetCompatibility 1.8 } * build.gradle(Module:app) - dependencies implementation "com.google.android.exoplayer:ex..

android 2020. 1. 31. 17:05
이전 1 2 3 4 다음
이전 다음
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
TAG
  • not working adb
  • nosql
  • 차번호 정규표현식
  • ubunut 설치 link
  • 클래스형 코드
  • rn
  • insert
  • https://medium.com/@limgyumin/%EC%BD%94%ED%8B%80%EB%A6%B0-%EC%9D%98-apply-with-let-also-run-%EC%9D%80-%EC%96%B8%EC%A0%9C-%EC%82%AC%EC%9A%A9%ED%95%98%EB%8A%94%EA%B0%80-4a517292df29
  • 귀찮아;;
  • 자바
  • https://hwan-shell.tistory.com/244
  • 명령어
  • 구글 맵 경로 그리기
  • spannableText
  • ubunut android
  • MongoDB
  • mongo db
  • not found adb
  • 차번호 정규식
  • 함수형 코드
  • not starting .bash_profile
  • react native state
  • Android
  • mac android
  • 안드로이드
  • text 부분 색 칠하기
  • adb 환경변수
  • 구글 맵 선그리기
  • 데이터베이스
  • React Native
more
«   2025/07   »
일 월 화 수 목 금 토
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 29 30 31
글 보관함

Blog is powered by Tistory / Designed by Tistory

티스토리툴바