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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T21:04:03+00:00 2026-06-09T21:04:03+00:00

Could some take a look at the below and try and explain what I’m

  • 0

Could some take a look at the below and try and explain what I’m missing? I’ve used the below method before in an application and its worked perfectly. Im sure its something silly I have missed and would love to get someone to look over it…

I input the air volume and pressure and click on my RadioButton ForwardCBD. This should create a double power, this should then be outputted to the screen but instead it causes the app to crash out.

Any ideas?

EditText AirVolume, Pressure,FCBD,BCBD,BCDD;
TextView Power;
RadioGroup Fans;
RadioButton ForwardCBD, BackwardCBD, BackwardCDD;


@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.car);

    AirVolume=(EditText)findViewById(R.id.AirVolume);
    Pressure=(EditText)findViewById(R.id.Pressure);

    Power=(TextView)findViewById(R.id.Power);

    ForwardCBD=(RadioButton)findViewById(R.id.ForwardCBD);
    BackwardCBD=(RadioButton)findViewById(R.id.BackwardCBD);
    BackwardCDD=(RadioButton)findViewById(R.id.BackwardCDD);

    Fans=(RadioGroup)findViewById(R.id.Fans);
    Fans.setOnCheckedChangeListener(this);

}   

public void onCheckedChanged(RadioGroup Fans, int aplication) {

    if (aplication==R.id.ForwardCBD){

        double airVolume = Double.parseDouble(AirVolume.getText().toString());
        double pressure = Double.parseDouble(Pressure.getText().toString());
        double fCBD = Double.parseDouble(FCBD.getText().toString());        
        double power = (airVolume * pressure) / (fCBD /100);
        DecimalFormat df = new DecimalFormat();
        Power.setText(df.format(power)+("W"));

    }
    if (aplication==R.id.BackwardCBD){

        double airVolume = Double.parseDouble(AirVolume.getText().toString());
        double pressure = Double.parseDouble(Pressure.getText().toString());
        double bCBD = Double.parseDouble(BCBD.getText().toString());        
        double power = (airVolume * pressure) / (bCBD /100);
        DecimalFormat df = new DecimalFormat();
        Power.setText(df.format(power)+("W"));

    }
    if (aplication==R.id.BackwardCDD){
        double airVolume = Double.parseDouble(AirVolume.getText().toString());
        double pressure = Double.parseDouble(Pressure.getText().toString());
        double bCDD = Double.parseDouble(BCDD.getText().toString());        
        double power = (airVolume * pressure) / (bCDD /100);
        DecimalFormat df = new DecimalFormat();
        Power.setText(df.format(power)+("W"));
    }

}   
}

See the LogCat below.

Not really sure how to present it in a decent format on here so sorry in advance!

08-19 12:10:24.576: E/AndroidRuntime(11733): FATAL EXCEPTION: main
08-19 12:10:24.576: E/AndroidRuntime(11733): java.lang.NullPointerException
08-19 12:10:24.576: E/AndroidRuntime(11733):    at com.test.will.CarSystems.onCheckedChanged(CarSystems.java:46)
08-19 12:10:24.576: E/AndroidRuntime(11733):    at android.widget.RadioGroup.setCheckedId(RadioGroup.java:172)
08-19 12:10:24.576: E/AndroidRuntime(11733):    at android.widget.RadioGroup.access$600(RadioGroup.java:52)
08-19 12:10:24.576: E/AndroidRuntime(11733):    at android.widget.RadioGroup$CheckedStateTracker.onCheckedChanged(RadioGroup.java:342)
08-19 12:10:24.576: E/AndroidRuntime(11733):    at android.widget.CompoundButton.setChecked(CompoundButton.java:128)
08-19 12:10:24.576: E/AndroidRuntime(11733):    at android.widget.CompoundButton.toggle(CompoundButton.java:87)
08-19 12:10:24.576: E/AndroidRuntime(11733):    at android.widget.RadioButton.toggle(RadioButton.java:75)
08-19 12:10:24.576: E/AndroidRuntime(11733):    at android.widget.CompoundButton.performClick(CompoundButton.java:99)
08-19 12:10:24.576: E/AndroidRuntime(11733):    at android.view.View$PerformClick.run(View.java:14400)
08-19 12:10:24.576: E/AndroidRuntime(11733):    at android.os.Handler.handleCallback(Handler.java:605)
08-19 12:10:24.576: E/AndroidRuntime(11733):    at android.os.Handler.dispatchMessage(Handler.java:92)
08-19 12:10:24.576: E/AndroidRuntime(11733):    at android.os.Looper.loop(Looper.java:154)
08-19 12:10:24.576: E/AndroidRuntime(11733):    at android.app.ActivityThread.main(ActivityThread.java:4945)
08-19 12:10:24.576: E/AndroidRuntime(11733):    at java.lang.reflect.Method.invokeNative(Native Method)
08-19 12:10:24.576: E/AndroidRuntime(11733):    at java.lang.reflect.Method.invoke(Method.java:511)
08-19 12:10:24.576: E/AndroidRuntime(11733):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
08-19 12:10:24.576: E/AndroidRuntime(11733):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
08-19 12:10:24.576: E/AndroidRuntime(11733):    at dalvik.system.NativeStart.main(Native Method)
  • 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-09T21:04:04+00:00Added an answer on June 9, 2026 at 9:04 pm

    Where have you assigned components to FCBD,BCBD,BCDD; which are probably null pointers.

    your calling

    double fCBD = Double.parseDouble(FCBD.getText().toString());
    

    But where have you defined/assigned FCBD i.e.

    FCBD=(EditText)findViewById(R.id.FCBD);
    

    Otherwise, step through in debug mode and you will find that one of your properties is null, which your trying to call a method upon.

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

Sidebar

Related Questions

Could you please take a look to my code below, I need to increase
Hi could some one please take a look at this and let me know
I could use some help with expression conversion. I have a method on a
I was wondering if I could send some data from my client-side (2d application
Could someone take a look at this code and find out what's wrong with
Could some on with Firebug or other tool check out this page. Take a
I'm working on a head tracking 3D application (take a look here if interested).
Could some one guide me to create a APS logon token in .Net programmatically?
Could some one give me pointers to tutorials that explains how to write a
Iam getting the following error , could some one help me how to fix

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.