Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DataBindingUtil.setContentView(this, R.layout.partial_question); throw view tag isn't correct on view:null #42

Open
rkmax opened this issue Apr 27, 2016 · 4 comments

Comments

@rkmax
Copy link

rkmax commented Apr 27, 2016

I'm using databindings on my project when I use on a DraggerActivity

DataBindingUtil.setContentView(this, R.layout.my_layout);

instead

setContentView(R.layout.my_layout);

I got

Caused by: java.lang.RuntimeException: view tag isn't correct on view:null
@rkmax
Copy link
Author

rkmax commented Apr 28, 2016

After a lot of trial and error what I did was copy the DraggerActivity source to and create my own DraggerActivity then add the following methods

private void configViews(View root) {
    this.draggerPanel.addViewOnDrag(root);
    if(this.shadowResID == -1) {
        this.shadowResID = com.github.ppamorim.dragger.R.layout.layout_shadow;
    }

    this.draggerPanel.addViewOnShadow(this.inflateLayout(this.shadowResID));
    super.setContentView(this.draggerPanel);
}


public void setContentView(View root) {
    this.configDraggerView();
    this.configViews(root);
    super.setContentView(this.draggerPanel);
}

then on the onCreate method

View rootView = getLayoutInflater().inflate(R.layout.my_Layout, null, false);
mBinding = DataBindingUtil.bind(rootView);

setContentView(rootView);

in that way I get enable data bindings to my DraggerActivity

@ppamorim
Copy link
Owner

ppamorim commented Apr 28, 2016

Oh, that's a good approach. Can you create a fork and a PR to merge these changes?
This library was created when the data binding wasn't popular/exists, then I don't tested with this feature. Sorry.

@rkmax
Copy link
Author

rkmax commented Apr 28, 2016

Sure. right now I'm rushing, but very soon I'll send you a PR

@mohameddawood
Copy link

thanks it works fineeeeee

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants