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

  • Home
  • SEARCH
  • 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 7779783
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T18:43:41+00:00 2026-06-01T18:43:41+00:00

I have absolutely no idea why I am getting a nullpointerexception here because almost

  • 0

I have absolutely no idea why I am getting a nullpointerexception here because almost this same exact code worked in a different program. I hope it’s something simple.

Here is the logcat:

04-09 08:18:57.903: ERROR/AndroidRuntime(14378): java.lang.NullPointerException
04-09 08:18:57.903: ERROR/AndroidRuntime(14378):     at com.prattia.webs.cheaterphysics.Vectors.storeInfo(Vectors.java:216)
04-09 08:18:57.903: ERROR/AndroidRuntime(14378):     at com.prattia.webs.cheaterphysics.Vectors$2.onClick(Vectors.java:67)
04-09 08:18:57.903: ERROR/AndroidRuntime(14378):     at android.view.View.performClick(View.java:2465)
04-09 08:18:57.903: ERROR/AndroidRuntime(14378):     at android.view.View$PerformClick.run(View.java:8907)
04-09 08:18:57.903: ERROR/AndroidRuntime(14378):     at android.os.Handler.handleCallback(Handler.java:587)
04-09 08:18:57.903: ERROR/AndroidRuntime(14378):     at android.os.Handler.dispatchMessage(Handler.java:92)
04-09 08:18:57.903: ERROR/AndroidRuntime(14378):     at android.os.Looper.loop(Looper.java:123)

Counter is as int initialized at 0 that keeps track of how many times next has been clicked in order to store vAnd here is part of the code with lines 67 and 216 marked:

next.setOnClickListener(new View.OnClickListener() {    
            public void onClick(View v) {
                error.setText("");
                if(value.toString().length()==0||angle.toString().length()==0)
                    error.setText("Must enter both value and angle");
                else{
                    storeInfo(); //67
                    counter++;
                }
            }
        });

public void storeInfo(){
        Doublify(value);
        Doublify(angle);

    //216   info[counter].value = Double.parseDouble(value.getText().toString());
        info[counter].angle = Double.parseDouble(angle.getText().toString());
        info[counter].radian = rad.isChecked();
        if(q1.isChecked())
            info[counter].quad=1;
        if(q2.isChecked())
            info[counter].quad=2;
        if(q3.isChecked())
            info[counter].quad=3;
        if(q4.isChecked())
            info[counter].quad=4;
        angle.setText("");
        value.setText("");
    }
  • 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-01T18:43:42+00:00Added an answer on June 1, 2026 at 6:43 pm

    On line 64 you use toString on the ‘value’ object which is likely to return the default implementation of the TextView toString() and probably not a 0 length

    value.toString()
    

    but on line 216 you use the correct way to get the text value, and since you didn’t test for it it is possible to be null:

    value.getText().toString()
    

    Change on line 64 to something like this:

    if(value.getText() == null || value.getText().toString().length() == 0)
    

    (and similar for the angle value )

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

Sidebar

Related Questions

I have absolutely no idea why this is happening but the following code seems
this morning I came across this code, and I have absolutely no idea what
I have absolutely no idea how to do this, so I'm just gonna go
I have absolutely no idea how Regex works. I'm using this bit of Regex
Sorry if this is a dumb question, but I have absolutely no idea how
I have some code that I absolutely must implement using goto . For example,
So I have this template design that is currently absolutely positioned, but I'm trying
let me first off noting that I have absolutely no idea what I'm doing
While searching I came across this . It looks interesting but I have absolutely
I have absolutely no idea what I'm doing wrong right now. I think I'm

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.