Last active
September 3, 2020 10:08
-
-
Save aslamanver/944d8a248f48a6f4cee691c2cdc3becd to your computer and use it in GitHub Desktop.
Android Data-Binding Util class
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.org.myapp; | |
import androidx.appcompat.app.AppCompatActivity; | |
import androidx.databinding.DataBindingUtil; | |
import androidx.databinding.ViewDataBinding; | |
public class BaseActivity<T extends ViewDataBinding> extends AppCompatActivity { | |
private ViewDataBinding binding; | |
protected void setBinding(int layoutResID) { | |
binding = DataBindingUtil.setContentView(this, layoutResID); | |
} | |
protected T getBinding() { | |
return (T) binding; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment