본문 바로가기

Programming25

[shell] 파일, 디렉토리 존재유무 체크 아래 접은 글이 사용하던 shell 샘플. 더보기 #!/bin/bash echo "start Release Build!!!------------------" if [ -f "/경로이름/." ]; then #뭐든 파일이 있는지 검사하기 위해 . echo "file exist" else echo "file not exist!!" git submodule init && git submodule update fi cd 경로 git checkout 브랜치이름 git pull cd .. ./gradlew prepare && ./gradlew clean assemble # 이건 프로젝트 빌드스크립트명령어.. echo "end command build" exit 0 test 나 [ ](대괄호)를 사용해서 파일존재 유무.. 2020. 5. 29.
Android MultiThread 에서의 SingleTon 패턴 Effective Java에서는 SingleTon 패턴을 위해 Enum을 활용하는 것을 제안하기도 하지만, Context 라는 개념이 있는 Android에서는 적합하지 않다. Singleton의 초기화 과정에 context의 의존성이 끼어들 여지가 있기때문이다. 좋은 참고글 https://medium.com/@joongwon/multi-thread-%ED%99%98%EA%B2%BD%EC%97%90%EC%84%9C%EC%9D%98-%EC%98%AC%EB%B0%94%EB%A5%B8-singleton-578d9511fd42 Multi Thread 환경에서의 올바른 Singleton 일반적으로 하나의 인스턴스만 존재해야 할 경우 Singleton 패턴을 사용하게 된다. 물론 Single Thread에서 사용되는.. 2020. 5. 12.
Avoiding Android memory leak 아래 글을 정리한 것 www.android.jlelse.eu/9-ways-to-avoid-memory-leaks-in-android-b6d81648e35e - Memory Leak 을 유발하는 것들과 Solutions. 원인 1: Broadcast Receivers Activity 내에 local Broadcast Receiver를 register 해두었는데, unregister를 하지 않으면, Activity가 종료된 후에도 Broadcast receiver가 activity 에 대한 참조를 가지고 있어서 leak 발생. 해결책) 항상 onStop에서 unregister()를 call 해라. **주의할점: Broadcast receiver를 onCreate()에서 register했다면 앱이 backgr.. 2020. 5. 11.
Fragment 의 getActivity(), getContext() null 처리 https://developer.android.com/guide/components/fragments.html?hl=ko#java 프래그먼트 | Android 개발자 | Android Developers A Fragment represents a behavior or a portion of user interface in an Activity. You can combine multiple fragments in a single activity to build a multi-pane UI and reuse a fragment in multiple activities. You can think of a fragment as a modular section… developer.android.com Fragme.. 2020. 4. 9.