일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- a
- 코틀린
- F
- designPattern
- Functional Programming
- 추상 팩토리
- 팩토리 메소드
- 함수형프로그래밍
- ㅓ
- ㅋㅁ
- Observer Pattern
- r
- 빌터패턴
- Singleton
- Abstract Factory
- El
- 디자인패턴
- builderPattern
- 디자인패턴 #
- 싱글톤
- factory method
- PrototypePattern
- Design Pattern
- 프로토타입 패턴
- Kotlin
- 추상팩토리패턴
- 옵저버 패턴
- Today
- Total
목록Android Jetpack Architecture (70)
오늘도 더 나은 코드를 작성하였습니까?
데이터 바인딩은 onClick() 메서드 등과 같은 이벤트를 뷰로 가져와서 처리할 수 있는 기능을 제공합니다. 이벤트 속성 이름은 리스너 메소드의 이름을 따른다. 예를 들어 OnClickListener를 구현 시 OnClick()을 작성해야 된다. 이벤트 속성의 이름은 adroid:onClick() = " " 이 된다. Button button; button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { } }); 데이터 바인딩에서는 이벤트를 다루는 방법에는 2가지가 있다. 두 방법의 가장 큰 차이점은 데이터의 바인딩이 일어날 때 실제 리스너의 생성을 하느냐 안 하느냐 이다. 메서드 참조 ..
속성 = @{ } 지원되지 않는 기능 - this - super - new - 명시적 제네릭 호출 Null 병합 연산자 (?? ) - 사용법 3항 연산자를 통해 이름이 있으면 이름을 텍스트로 지정하고 없으면 string 리소스를 지정한다. 이걸 Null 병합 연산자를 통해 다음처럼 줄여 쓸 수 있다. 피연산자(왼쪽)?? 피연산자(오른쪽) ---> 왼쪽의 값이 날이 아니면 그대로 지정 날이면 오른쪽의 값을 지정 null 포인터 예외 방지 생성된 데이터 결합 코드는 자동으로 null 값을 확인하고 null 포인터 예외를 방지합니다. 예를 들어 @{user.name} 표현식에서 user가 null이면 user.name에 null이 기본값으로 할당됩니다. age의 유형이 int인 user.age를 참조하면 데이..
이 글은 송유섭 (NAVER / 라이브 서비스 개발)님의 발표자료를 많이 참고하였습니다. 자동 메서드 선택 - 데이터 바인딩 라이브리러리는 자동으로 호환 가능한 매개변수 타입을 갖는 setXXX(arg) 메서드를 찾으려고 시도한다. - View의 attribute의 이름과 타입이 메서드를 찾는 데 사용된다. - 아래 예제를 보면 TextView의 enabled 속성의 boolean 타입을 통해 setEnable(Boolean value) 찾아 호출한다. - 바인딩 표현식은 반드시 정확한 타입을 반환해야 되며 필요하다면 캐스팅을 해야 할 수도 있다. - 자동으로 찾아줄 때 어떤 순서로 찾는 것인가? BindingAdapter --> BindingMethod --> Set Method BindingMetho..
왜 DataBinding 이 필요할까? MVVM 패턴에서 DataBinding 및 LiveData(Observable)을 이용하여 MVP 패턴에서 View와 Presenter 간의 높은 의존성을 약하게 만들어야 되었다. ViewModel은 View에 표현될 데이터를 관리 및 비지니스 로직을 처리한다. 이 데이터를 View과 관찰하고 하고 있다가 비즈니스 로직에 따라 데이터가 변경이 되면 즉시 반영할 수 있다. ViewModel이 View에 대한 의존성을 갖지 않고 느슨하게 연결되려면 DataBinding가 필수적이다. 데이터 바인딩 기본. 모듈 수준 그레이들 파일에 build.gradle(Moudule: app) 데이터 바인딩 허용. android { dataBinding { enabled = true ..