android - Start a new activity from an Imagebutton inside a fragment -
i have fragment
class button
, want start new activity
button
.
me please?
here mainfragment.class:
public class mainfragment extends fragment { public mainfragment() { // required empty public constructor } @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { // inflate layout fragment return inflater.inflate(r.layout.fragment_main, container, false); } }
@override public void onviewcreated(view view, bundle savedinstancestate) { view.findviewbyid(r.id.buttonid).setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { startactivity(new intent(...)); } }); }
replace buttonid
id of button , fill out intent
.
Comments
Post a Comment