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..
1. onAttach()에서 Context 파라미터를 이용하여 Activity 객체를 생성하는 방법 2. Bundle 객체를 생성해서 Fragment의 전달인자로 보내는 방법 3. ViewModel을 공유하는 방법 1. onAttach()에서 Context 파라미터로 Activity 객체 생성하여 전달받는 방법 activity_main.xml fragment_red.xml fragment_green.xml FragmentGreen.kt package com.jwsoft.kotlinproject import android.content.Context import android.os.Bundle import android.view.LayoutInflater import android.view.View imp..
1. Intent(+Serializable, Parcelable) 이용하는 방법 2. startActivityForResult 이용하는 방법 1. Intent(+Serializable, Parcelable) 이용하는 방법 SerializablePrivacy.kt package com.jwsoft.kotlinproject import java.io.Serializable class SerializablePrivacy( var height: Int, var weight: Int ) : Serializable ParcelableDetail.kt package com.jwsoft.kotlinproject import android.os.Parcel import android.os.Parcelable class ..
참조(Reference)와 GC(Garbage Collection)의 관계 1. Strong Reference public class JavaTest { public static void main(String[] args) { MyClass obj = new MyClass(); obj = null; // "obj" object is no longer referencing to the instance. // So the "MyClass" type object is now available for garbage collection. } } class MyClass { } // Java program to illustrate Strong reference class MyClass { //Code.. } pub..
1. StrongReference - 일반적으로 new를 통해서 객체를 생성하게 되면 생기게 되는 참조 - 강한 참조를 통해 참조되고 있는 객체는 GC(Garbage Collection)의 대상에서 제외 - GC(Garbage Collection)가 발생해도 객체가 해제되지 않기 때문에 OOM(Out of memory)이 발생할 수 있음 2. SoftReference - 강한 참조와는 다르게 GC(Garbage Collection)에 의해 수거될 수도 있고, 수거되지 않을 수도 있음 - 메모리에 충분한 여유가 있으면 GC(Garbage Collection)가 수행돼도 수거되지 않음 - GC(Garbage Collection)가 발생하면 수거되므로 OOM(Out of memory)의 위험성을 줄일 수 있음..
- Total
- Today
- Yesterday
- MVVM
- ViewPager2
- 안드로이드 #코틀린 #Android #Kotlin
- 안드로이드
- CoordinatorLayout
- 코틀린
- Livedata
- java
- Kotlin
- ArrayList
- Android
- fragment
- Design Pattern
- JSONObject
- 자바
- handler
- Intent
- Architecture Pattern
- ViewModel
- recyclerview
- activity
- View
- XML
- TabLayout
- DataBinding
- JSONArray
- Vue.js #Vue.js + javascript
- James Kim
- coroutine
- 혀가 길지 않은 개발자
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |