android - How i can get ActionBarActivity from a Calss that extends from Fragment? -
how can actionbaractivity
class
extends
fragment
.
this class :
public class email_fragment extends fragment{ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); actionbaractivity activity ; activity = this; } public email_fragment() { super(); } @override public void onattach(activity activity) { super.onattach(activity); } @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view rootview = inflater.inflate(r.layout.email_fragment, container, false); return rootview; } }
i need :
actionbaractivity activity ; activity = this;
and need use clicklistener
.
notice : using import android.support.v7.app.actionbaractivity;
in fragment can call getactivity() "parent" activity. if fragment lives inside of actiobaractivity can cast follows:
actionbaractivity activity = (actionbaractivity) getactivity();
Comments
Post a Comment