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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T06:38:51+00:00 2026-06-18T06:38:51+00:00

Commented out almost everything still can’t find the null ?? I only get this

  • 0

Commented out almost everything still can’t find the null ?? I only get this error on 2.1 any higher all works well ?? Thanks for the help.

public class BizProfiles extends Activity {

    private Button button;
    private Button btnFbLogin;
    private Button btnPostToWall;
    private Button btnTLogin;
     // Facebook APP ID
    private static String APP_ID = "App ID here"; // 

    // Instance of Facebook Class
    private Facebook facebook;
    @SuppressWarnings("unused")
    private AsyncFacebookRunner mAsyncRunner;
    String FILENAME = "AndroidSSO_data";
    private SharedPreferences mPrefs;


    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        final Context context = this;
        super.onCreate(savedInstanceState);
        facebook = new Facebook(APP_ID);
        mAsyncRunner = new AsyncFacebookRunner(facebook);



        /////////////////////////////////////////////////////////////////////////////////
        Display display = getWindowManager().getDefaultDisplay(); 
        int width = display.getWidth();
        int height = display.getHeight();
        if (width == 320 && height == 480)
        {
              setContentView(R.layout.bizprofiles320); 
              Log.v("blah", "320 layout");
        }
        else
        {
            Log.v("blah", "480 800 layout");


            setContentView(R.layout.bizprofiles);
        //////
        }
//      String name = getIntent().getExtras().getString("BizName");
//      String address = getIntent().getExtras().getString("BizAddress");
//      String phone = getIntent().getExtras().getString("BizPhone");
//      String about = getIntent().getExtras().getString("BizAbout");
//      String monfri = getIntent().getExtras().getString("BizMonFri");
//      String satsun = getIntent().getExtras().getString("BizSatSun");
//      String imgname = getIntent().getExtras().getString("BizImg");
//      final String website = getIntent().getExtras().getString("BizWeb");


        //////
        button = (Button) findViewById(R.id.button1);
        button.setOnClickListener(new View.OnClickListener() {

          public void onClick(View arg0) {
            Intent intent = new Intent(context, BizWebSite.class);
         //   intent.putExtra("BizWeb", website.toString());
            startActivity(intent);
          } });

        btnFbLogin = (Button) findViewById(R.id.button2);
        btnFbLogin.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                    loginToFacebook();
                }
        });

        btnPostToWall = (Button) findViewById(R.id.Button01);
        btnPostToWall.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                postToWall();
            }
        });


        btnTLogin = (Button) findViewById(R.id.tlogin);
        btnTLogin.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
//              Intent intent = new Intent(context, TweetPage.class);
//           //   intent.putExtra("BizWeb", website.toString());
//              startActivity(intent);

                 new Twitter_Dialog(BizProfiles.this,"http://twitter.com/?status="+Uri.encode("Twitter Post")).show();

            }
        });

       // String getimg = imgname;
//        int resID = getResources().getIdentifier(imgname, "drawable", "com.RforR.ForPlay1");
//      ImageView image = (ImageView) findViewById(R.id.imageView3); //null;
//      image.setImageResource(resID);
        //System.out.println(resID);
        //Log.v("blah*************", resID);

//      AutoResizeTextView obtar = new AutoResizeTextView(context);
//      obtar tvme = (TextView) findViewById(R.id.tvName);

//        TextView theTextView = (TextView) findViewById(R.id.tvName);
//        theTextView.setText(name);
//        TextView theAdd = (TextView) findViewById(R.id.tvAddress);
//        theAdd.setText(address);
//        TextView thePhone = (TextView) findViewById(R.id.tvPhone);
//        thePhone.setText(phone);

    }



    public void onGetNames(View gn)
    {

//      String name = getIntent().getExtras().getString("BizName");
//      String address = getIntent().getExtras().getString("BizAddress");
//      String phone = getIntent().getExtras().getString("BizName");
//      String about = getIntent().getExtras().getString("BizAbout");
//      String monfri = getIntent().getExtras().getString("BizMonFri");
//      String satsun = getIntent().getExtras().getString("BizSatSun");
//      
//      System.out.println(name);
//      System.out.println(about);
//      System.out.println(satsun);


        Log.v("blah", "blah blah");

    }


    public void loginToFacebook() {
        mPrefs = getPreferences(MODE_PRIVATE);
        String access_token = mPrefs.getString("access_token", null);
        long expires = mPrefs.getLong("access_expires", 0);

        if (access_token != null) {
            facebook.setAccessToken(access_token);
        }

        if (expires != 0) {
            facebook.setAccessExpires(expires);
        }

        if (!facebook.isSessionValid()) {
            facebook.authorize(this,
                    new String[] { "email", "publish_stream" },
                    new DialogListener() {

                        public void onCancel() {
                            // Function to handle cancel event
                        }

                        public void onComplete(Bundle values) {
                            // Function to handle complete event
                            // Edit Preferences and update facebook acess_token
                            SharedPreferences.Editor editor = mPrefs.edit();
                            editor.putString("access_token",
                                    facebook.getAccessToken());
                            editor.putLong("access_expires",
                                    facebook.getAccessExpires());
                            editor.commit();
                        }

                        public void onError(DialogError error) {
                            // Function to handle error

                        }

                        public void onFacebookError(FacebookError fberror) {
                            // Function to handle Facebook errors

                        }

                    });
        }
    }


    public void postToWall() {
        // post on user's wall.
        facebook.dialog(this, "feed", new DialogListener() {

            public void onFacebookError(FacebookError e) {
            }

            public void onError(DialogError e) {
            }

            public void onComplete(Bundle values) {
            }

            public void onCancel() {
            }
        });

    }



    public void onGoBk(View cc)
    {

        finish();
    }


}

logcat

enter image description here

  • 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-18T06:38:52+00:00Added an answer on June 18, 2026 at 6:38 am

    You are getting your null pointer exception on 21 and below because getHeight and getWidth were added then. Try this ;

    if (  Integer.valueOf(android.os.Build.VERSION.SDK_INT) < 13 ) {
         Display display = getWindowManager().getDefaultDisplay(); 
         int width = display.getWidth();
         int height = display.getHeight();
       } else {
           Display display = getWindowManager().getDefaultDisplay();
              Point size = new Point();
              display.getSize(size);
              int width = size.x;
              int height = size.y;
       }
    

    You may need to play around with the API level (I can’t remember what 2.1 is)

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

Sidebar

Related Questions

I have tried almost everything and I can't seem to get my lists to
The django csrf middleware can't be disabled. I've commented it out from my Middleware
I have commented out the hi Fold … line in my current vim-colorscheme (xoria256
I have an html document with multiple commented-out PHP arrays, e.g.: <!-- Array (
I am cleaning up a .cfm file and removing commented out code. I'm not
I've put together a pretty simple competition script - it's commented out below and
When a piece of code is commented we say just that, it's commented out.
Here's my code. See the line that is commented out. When the element id
Can I comment out lines which have other comments? /* * comment 1 */
Hopefully I can explain this clearly enough. I have a table that displays some

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.