java - FacbookActivity in Fragment convert -
i have facebookactivity , have convert activity fragment.
my fragment:
public class fragment3 extends fragment{ view contentview3; @nullable @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { facebooksdk.sdkinitialize(getapplicationcontext()); appeventslogger.activateapp(getactivity()); contentview3 = inflater.inflate(r.layout.activity_login, null); return contentview3; } @override public void onviewcreated(view view, @nullable bundle savedinstancestate) { button btn = (button)contentview3.findviewbyid(r.id.fbbutton); btn.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { intent fb = new intent (getactivity().getapplicationcontext(), login.class); startactivity(fb); } }); super.onviewcreated(view, savedinstancestate); } }
when run fragment app unfortunately closed.
my activity_login:
<framelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/container" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".fragment3"> </framelayout>
Comments
Post a Comment