I have implemented facebook login through facebook sdk 4.3 I have made separate dialog fragment for login of facebook. Till now Every thing is working very well.
What I want I want to implement facebook log out button in the bottom of my navigation view to get logout but I do not have idea how to implement it. Because I have implemented facebook login through facebook login button . and I have seen after login that button change into a facebook logout button. Now I want two thing
How to insert a button in navigation view As I have made navigation view through new design technique and what ever I have added in that is through navigation menu. So I do not have idea how to add button in it
Secondly I do not know how to get log out from facebook using native or custom button. which function I have to implement
What i have searched so far , they are getting logout thorough session which now do not exist in facebook new sdk. So I have no idea How to implement it separately
For you let me put some code so that you come to know How I have implemented my Navigation view
this coede is in my main xml for navigation view
<android.support.design.widget.NavigationView
android:id="@+id/navigation_view"
android:layout_height="match_parent"
android:layout_width="wrap_content"
android:layout_gravity="fill_vertical|left"
app:menu="@menu/drawer"
app:itemTextColor="#ffffff"
android:background="#AF4B02"
app:itemIconTint="@color/navigation_icon"
android:fadingEdge="horizontal"/>
and this is my drawer item in menu folder
<group android:checkableBehavior="single">
<item
android:id="@+id/home"
android:checked="false"
android:icon="@drawable/drawer_ic_home"
android:title="@string/home_string" />
<item
android:id="@+id/offer"
android:checked="false"
android:icon="@drawable/drawer_ic_offer"
android:title="@string/offer_string" />
<item
android:id="@+id/share"
android:checked="false"
android:icon="@drawable/drawer_ic_share"
android:title="@string/share" />
<item
android:id="@+id/take"
android:checked="false"
android:icon="@drawable/drawer_ic_take"
android:title="@string/take" />
<item
android:id="@+id/offer_status"
android:checked="false"
android:icon="@drawable/drawer_ic_status"
android:title="@string/offer_status"
/>
<item
android:id="@+id/about_us"
android:checked="false"
android:icon="@drawable/drawer_ic_about_us"
android:title="@string/about_us_string" />
</group>
so now in navigation view I want to add button at the bottom of the Navigation view So tell me How to do this ? how to listen its click event and then on that click How to logout from facebook?
Please help .
Here is how I add button to the bottom of navigation view
<android.support.design.widget.NavigationView
android:id="@+id/navigation_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="@color/white"
app:headerLayout="@layout/navigation_view_header"
app:itemIconTint="@drawable/navigation_selector_text"
app:itemTextColor="@drawable/navigation_selector_text"
app:menu="@menu/side_navigation_menu_login">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<FacebookButton
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true">
</FacebookButton>
</RelativeLayout>
</android.support.design.widget.NavigationView>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With