this question has answer here:
- findviewbyid in fragment 30 answers
i have piece of code in fragment says cannot resolve method findviewbyid
@override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view fragmentlayout = inflater.inflate(r.layout.fragment_note_detail, container, false); floatingactionbutton fab = (floatingactionbutton) findviewbyid(r.id.fab); fab.setonclicklistener(new view.onclicklistener() { @override public void onclick(view view) { } }); }
it should be:
floatingactionbutton fab = (floatingactionbutton)fragmentlayout.findviewbyid(r.id.fab);
Comments
Post a Comment