android - Implement a button in a fragment for tabbed activity after click should goto new activity -


this code fragment. please me place button , onclick should go respective activity

class boards extends fragment {  @nullable @override public view oncreateview(layoutinflater inflater, @nullable viewgroup container, bundle savedinstancestate) {     return inflater.inflate(r.layout.boards, container, false);  }  } 

inside onviewcreated method:

view view = inflater.inflate(r.layout.boards, container, false); button button = (button) view.findviewbyid(r.id.buttonid); button.setonclicklistener(new onclicklistener(){     @override     public void onclick(view v){         //         startactivity(new intent(getactivity(), youractivity.class));     }  });  return view; 

Comments

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -