-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathP38_b.kt
42 lines (31 loc) · 976 Bytes
/
P38_b.kt
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
32
33
34
35
36
37
38
39
40
41
42
package com.example.two
import android.os.Bundle
import android.util.Log
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
class FragmentTwo : Fragment() {
lateinit var view1: View
lateinit var txt: TextView
// override fun onCreate(savedInstanceState: Bundle?) {
// super.onCreate(savedInstanceState)
// }
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
// Inflate the layout for this fragment
view1 = inflater.inflate(R.layout.fragment_two, container, false)
return view1
}
fun onFragmentInteraction(msg: String) {
Log.d("Worked", msg)
txt = view1.findViewById(R.id.txt)
txt.text = msg
}
fun onFragmentInteractionColor(code: Int) {
view1.setBackgroundColor(code)
}
}