1. Interface를 이용하는 방법 2. Bundle 객체를 생성해서 Fragment의 전달인자로 보내는 방법 3. requireActivity()를 전달인자로 사용한 ViewModel을 공유하는 방법 4. requireParentFragment()를 전달인자로 사용한 ViewModel을 공유하는 방법 1. Interface를 이용하는 방법 activity_main.xml fragment_parent.xml fragment_child.xml FragmentListener.kt package com.jwsoft.kotlinproject interface FragmentListener { fun onReceivedData(data: String) } MainActivity.kt package com.jw..
1. Interface를 이용하는 방법 2. ViewModel을 공유하는 방법 1. Interface를 이용하는 방법 fragment_red.xml fragment_green.xml activity_main.xml FragmentListener.kt package com.jwsoft.kotlinproject interface FragmentListener { fun onReceivedData(data: String, fragment: String) } FragmentRed.kt package com.jwsoft.kotlinproject import android.content.Context import android.os.Bundle import android.view.LayoutInflater impo..
1. Interface를 이용하는 방법 2. ViewModel을 공유하는 방법 1. Interface를 이용하는 방법 fragment_red.xml fragment_green.xml activity_main.xml FragmentRed.kt package com.jwsoft.kotlinproject import android.content.Context import android.os.Bundle import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import androidx.fragment.app.Fragment import kotlinx.android.synthetic.main.fragment..
- Total
- Today
- Yesterday
- Architecture Pattern
- Intent
- TabLayout
- coroutine
- fragment
- XML
- MVVM
- 코틀린
- recyclerview
- 자바
- View
- Livedata
- James Kim
- ArrayList
- ViewPager2
- 안드로이드 #코틀린 #Android #Kotlin
- Kotlin
- CoordinatorLayout
- JSONObject
- ViewModel
- 혀가 길지 않은 개발자
- DataBinding
- Vue.js #Vue.js + javascript
- handler
- JSONArray
- Android
- java
- 안드로이드
- activity
- Design Pattern
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |