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 6050097
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:39:02+00:00 2026-05-23T07:39:02+00:00

My code is like this — I am trying to fetch my facebook profile

  • 0

My code is like this —
I am trying to fetch my facebook profile data
such as name , email etc and want to replace it as
on my own UI.
I am able to fetch the data , now i want to update my UI
with a real data .since i am not using onCreate() , i am getting NPE
when i called setText(b.getString(key));
what should i do , since my state is saved on Bundle b
so overrriding onCreate() doesnt seems to an option ??
any help ??

package com.android.soapbox;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.widget.TextView;
import com.android.soapbox.SoapboxApplication.ProfileEventListener;

public class ProfileInfoListner extends Activity  implements ProfileEventListener
{
public TextView mFirstNameTextBox  ;
public TextView mLastNameTextBox  ;


public void ProfileInfoAvailable(Bundle b)
{
 Log.e("Facebook-Example", "Login_sucess"); 
//Go though all the info in the bundle and display

try
{

    for (String key : b.keySet()) 
    {

        if(key.compareTo(SoapboxApplication.FIRST_NAME) == 0)
        {
            Log.e("Facebook-Example", "Log-Printed");   
            //Assuming mFirstNameTextBox points to the textbox on PRofile screen



      if(mFirstNameTextBox!=null)
      {

              Log.e("Facebook-Example", "nnF");
              // NPE
          mFirstNameTextBox.setText(b.getString(key));
      }


        }

}
}
catch(NullPointerException c)
{
    Log.e("ERROR","NPE2"+c.fillInStackTrace());
}

    }   


}
  • 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-05-23T07:39:02+00:00Added an answer on May 23, 2026 at 7:39 am

    You have to make sure that no other thread than the UI thread is executing your ProfileInfoAvailable method. You can make sure of this by using the following code

    runOnUiThread(new Runnable() {
        public void run() {
            mFirstNameTextBox.setText(b.getString(key));
        }
    }
    

    The onCreate method of an Activity is always run on the UI thread. If you want to use this, add something like this

    Intent i = new Intent(CurrentIntent.this, NewIntentToLaunch.class);
    i.putExtra("name", userName);
    ...add more data
    startActivity(i);
    

    to launch the activity and use something like this

    public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
    
      Bundle extras = this.getIntent().getExtras();
      if (extras != null && extras.containsKey("name")) {
          String userName = this.getIntent().getExtras().getString("name");
      }
    }
    

    to read it in your onCreate method.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have ruby code like this: module Hello class Hi def initialize() puts self.module.name
I have a code like this: <object> . . . <param name=url value=http://box.net/test/datefile.pdf> .
I have for eg code like this function check(parameters){ some code; $.post('/url', function(data) {
I want to refactor code like this: int x=4; int y=x; System.out.println(y); How can
I want to write code like this: command="some command" safeRunCommand $command safeRunCommand() { cmnd=$1
My code like this ResultSet rs = statement.executeQuery( SELECT SUM(column1) FROM table where column2=name
Code like this often happens: l = [] while foo: # baz l.append(bar) #
The code like this: $(.hide).click(function(){ $(.online-contact).animate({width: 'toggle',height: '100%'}, fast); $(this).hide(); $(.show-class).show(); }) I want
Suppose code like this: class Base: def start(self): pass def stop(self) pass class A(Base):
In code like this, get '/posts.?:format?' do # ... end How can I get

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.