Created
December 7, 2020 16:44
-
-
Save ch8n/f49098072300454fddcb37ff7b9e74b1 to your computer and use it in GitHub Desktop.
sample for activity using base activity for view binding | checkout complete blog from - https://chetangupta.net/viewbinding/
This file contains hidden or 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
// Source : https://chetangupta.net/viewbinding/ | |
// file name : profile_layout.xml | |
<FrameLayout ... > | |
<TextView android:id="@+id/text_name" ... /> | |
<TextView android:id="@+id/text_twitter" ... /> | |
<TextView android:id="@+id/text_blog" ... /> | |
</FrameLayout> | |
// controller activity class | |
class ProfileActivity :ViewBindingActivity<ProfileLayoutBinding>() { | |
override val bindingInflater: (LayoutInflater) -> ViewBinding | |
= ProfileLayoutBinding::inflate | |
override fun setup() = with(binding){ | |
textAuthor = "chetan gupta" | |
textTwitter = "ch8n2" | |
textBlog = "chetangupta.net" | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment