How to put Facebook Logout button in the end of navigation view
Asked Answered
C

1

5

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

  1. 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

  2. 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 .

Colum answered 9/9, 2015 at 19:12 Comment(0)
W
8

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>
Worden answered 9/9, 2015 at 19:22 Comment(11)
what is FacebookButton ?Colum
I mean how would it show and also tell me how to listen it click and where please provide this code tooColum
The facebook is what ever the facebook button is. You would set the onClickListener in NavigationView activityWorden
do you know the way How to put facebook logout button here ?Colum
its giving me error ClassNotFoundException: Didn't find class "android.view.FacebookButton" on path: DexPathListColum
Yea because you need to add the facebook api into your application. That is not the exact name for facebook. You would need to go through their api documentation.Worden
so you do not know how to add the button of facebookColum
well I think you have answered my question 1 partColum
Is there a logout button in the facebook api?Worden
I dont know , I have implemented log in button and after login that converts into a logout buttonColum
FacebookButton is nota view coming from the android sdk you need to reference the correct view from the correct library, which FacebookButton is not in the android sdk and more likely to be in the facebook sdk.Helices

© 2022 - 2024 — McMap. All rights reserved.