Created
March 29, 2021 15:46
-
-
Save mzaimilzam/c3bfbea2f255065dd3acc90b3c6b0988 to your computer and use it in GitHub Desktop.
new way new way
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.mzaiilzam.viewbindingdelegate | |
import android.os.Bundle | |
import androidx.fragment.app.Fragment | |
import android.view.LayoutInflater | |
import android.view.View | |
import android.view.ViewGroup | |
import android.viewbinding.library.fragment.viewBinding | |
import com.mzaiilzam.viewbindingdelegate.databinding.FragmentFirstBinding | |
class FirstFragment : Fragment() { | |
// add this code | |
private val binding : FragmentFirstBinding by viewBinding() | |
override fun onCreateView( | |
inflater: LayoutInflater, container: ViewGroup?, | |
savedInstanceState: Bundle? | |
): View? { | |
// Inflate the layout for this fragment | |
return inflater.inflate(R.layout.fragment_first, container, false) | |
} | |
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | |
super.onViewCreated(view, savedInstanceState) | |
binding.textView.text = "mzaimilzam" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment