java - calling View inside a View in android -
how call view inside view on click of button in android. here code:
public class fragment2 extends fragment1 { public fragment2() {} @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); } public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view view = inflater.inflate(r.layout.fragment_layout_one, container, false); button.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { // how call here } }); return view; } } is there way call view on click of button.
if understand issue correctly, then, possibly looking this:
public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view view = inflater.inflate(r.layout.fragment_layout_one, container, false); fragmenttransaction transaction = getfragmentmanager().begintransaction(); button.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { transaction.replace(r.id.fragment_container, newfragment); transaction.commit(); } }); return view; }
Comments
Post a Comment