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

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -