Created
May 19, 2017 00:37
-
-
Save ChaMinGyu/0931cb4f849ab1828e51139afe91542f to your computer and use it in GitHub Desktop.
Activity DataBinding
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
import android.databinding.DataBindingUtil; | |
import android.databinding.ViewDataBinding; | |
import android.support.annotation.LayoutRes; | |
import android.support.v7.app.AppCompatActivity; | |
import android.view.View; | |
public class BaseActivity <T extends ViewDataBinding> extends AppCompatActivity { | |
private T bind; | |
public T getBind() { return bind; } | |
public void setBindActivity(@LayoutRes int layoutId){ | |
bind = DataBindingUtil.setContentView(this, layoutId); | |
} | |
public View setBindView(View view){ | |
bind = DataBindingUtil.bind(view); | |
return bind.getRoot(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment