본문 바로가기

전체 글

(103)
안드로이드 스튜디오 / koin 으로viewModel 의존성 주입 시 viewModel을 공유할 경우 2개 이상의 View가 1개의 ViewModel을 공유할 경우 by sharedViewModel()로 주입한다. 단, Fragment에서만 사용. 부모 Activity에서는 by viewModel() 사용하면 된다.
vscode java 단축키 sysout : System.out.println() main : public static void main(String[] args) shift+art+화살표 : 한줄 복사 ctrl+shift+k : 한줄 삭제
안드로이드 스튜디오 / Constraintlayout app 속성 layout_constraint방향_to방향of속성을 이용해서 각 위젯간 관계를 설정해줄 수 있다. top 위 bottom 아래 start 왼쪽 end 오른쪽 ex) android:id="@+id/text_view1" app:layout_constraintBottom_toTopOf="@+id/text_view2" -> text_view1의 Bottom(아래부분)을 text_view2의 Top(위)에 위치시킨다. android:id="@+id/text_view2" app:layout_constraintTop_toBottomOf="@+id/text_view1" -> text_view2의 Top(위)을 text_view1의 Bottom(아래)에 위치시킨다. !! constraintBottom_ cosntrai..
안드로이드 스튜디오 / Firebase Could not deserialize object 에러 ~~~ does not define a no-rgument constructor. If you are using ProGuard, make sure these constructors are not stripped. 해당 오류는 Firebase의 객체를 역직렬화 하려면 DTO 클래스에 빈 생성자가 필요해서 발생한 것이다. 따라서, DTO클래스의 멤버 변수에 default 값을 주는 것으로 해결 가능하다. data class User ( val email : String = "", val name : String ="", val image : String = "", val uid : String = "" ) 객체 데이터 초기화해주기~
안드로이드 스튜디오 / Google SignInButton Text 수정 방법 구글 로그인 버튼의 Text를 바꾸고 싶었다. 조금 옛날 글이지만 역시.. 해결책은 존재했다. https://stackoverflow.com/questions/18040815/can-i-edit-the-text-of-sign-in-button-on-google/27838453#27838453 Can I edit the text of sign in button on Google? I am integrating my application with google plus. I have installed google play services and signed in to my account. Also I could publish and plus one for what ever I want. My problem I..
안드로이드 스튜디오 / layout 둥근 모서리 적용 1. drawable 폴더 안에 layout_radius.xml 파일 생성 shape으로 감싸고 안에 상세 속성들을 넣어준다. - solid : 뷰의 background - corners : 모서리 부분 bottomRightRadius, bottomLeftRadius, topLeftRadius, topRightRadius 따로 적용 가능 2. layout에 적용 android:background="@drawable/layout_radius"
안드로이드 스튜디오/ Retrofit/OkHttpClient 로그 찍는 방법 Retrofit에서 모든 통신을 로그찍어서 보고 싶다면 addInterceptor를 해주면 된다. //설명추가 예정 val httpLoggingInterceptor = HttpLoggingInterceptor() httpLoggingInterceptor.apply{ httpLoggingInterceptor.level = HttpLoggingInterceptor.Level.BODY } OkHttpClient.Builder() .addInterceptor(httpLoggingInterceptor) .build()
안드로이드 스튜디오/ startActivityForResult Deprecated startActivityForResult가 Deprecated 되었다. 요즘 registerForActivityResult로 대체해서 쓰고있다. 1. intentParam() 따로 빼주기 (필수X, 편의상 ) fun getIntentParam(): Intent{ val newIntent = Intent(this.context,Activity::class.java) newIntetn.putExtra() return newIntent } 2. registerForActivityResult 사용하기 private var getResult = registerForActivityResult(ActivityResultContracts.StartActivityForResult()){ if(it.resultCode =..

반응형