Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8509999
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T03:35:11+00:00 2026-06-11T03:35:11+00:00

I am using One button called logout.This logout is for facebook logout option for

  • 0

I am using One button called logout.This logout is for facebook logout option for the user from the app.When i click on this buton ‘m getting below errors.

I commented the line in below code where ‘m getting this error.

09-11 15:25:30.124: E/AndroidRuntime(6866): FATAL EXCEPTION: main
> 09-11 15:25:30.124: E/AndroidRuntime(6866):
> java.lang.NullPointerException 09-11 15:25:30.124:
> E/AndroidRuntime(6866):   at
> com.example.settings.Settings$1.logout(Settings.java:46) 09-11
> 15:25:30.124: E/AndroidRuntime(6866):     at
> com.example.settings.Settings$1.onClick(Settings.java:38) 09-11
> 15:25:30.124: E/AndroidRuntime(6866):     at
> android.view.View.performClick(View.java:2485) 09-11 15:25:30.124:
> E/AndroidRuntime(6866):   at
> android.view.View$PerformClick.run(View.java:9080) 09-11 15:25:30.124:
> E/AndroidRuntime(6866):   at
> android.os.Handler.handleCallback(Handler.java:587) 09-11
> 15:25:30.124: E/AndroidRuntime(6866):     at
> android.os.Handler.dispatchMessage(Handler.java:92) 09-11
> 15:25:30.124: E/AndroidRuntime(6866):     at
> android.os.Looper.loop(Looper.java:123) 09-11 15:25:30.124:
> E/AndroidRuntime(6866):   at
> android.app.ActivityThread.main(ActivityThread.java:3683) 09-11
> 15:25:30.124: E/AndroidRuntime(6866):     at
> java.lang.reflect.Method.invokeNative(Native Method) 09-11
> 15:25:30.124: E/AndroidRuntime(6866):     at
> java.lang.reflect.Method.invoke(Method.java:507) 09-11 15:25:30.124:
> E/AndroidRuntime(6866):   at
> com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
> 09-11 15:25:30.124: E/AndroidRuntime(6866):   at
> com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) 09-11
> 15:25:30.124: E/AndroidRuntime(6866):     at
> dalvik.system.NativeStart.main(Native Method)

My code :

Facebook fb;

Button btn_logout = (Button)findViewById(R.id.logout);
               btn_logout.setOnClickListener(new View.OnClickListener() {

        public  void onClick(View v) {
            // TODO Auto-generated method stub
            String response = logout();//error
            Toast.makeText(getApplicationContext(), "Logout"+ response , 2).show();
        }

        public String logout() {
            // TODO Auto-generated method stub
            String res = null;
            try {
                  res = fb.logout(getApplicationContext());//error

            } catch (MalformedURLException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            return res;
        }


    });
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T03:35:13+00:00Added an answer on June 11, 2026 at 3:35 am

    You may forget to initialize Facebook fb;

    Facebook fb= new Facebook("APP_ID");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using two functions one is from this site http://ryanfait.com/resources/custom-checkboxes-and-radio-buttons/ and its using function
I have one more button on the page called Edit when I click on
hi i am doing one app here when i click button that time i
I'm adding HTML controls dynamically using java script. For instance, I have one button
i am trying to create a Radio button using Cakephp like the one the
I have two forms. First one is to decide button numbers by using jslider.
I'm posting some info to a user's wall via Facebook Connect (from my external
I have two forms. First one is to decide numbers of button by using
Using Stack Overflow question How to send an object from one Android Activity to
I can successfully show the calendar when clicking on the button using property called

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.