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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T20:32:41+00:00 2026-05-24T20:32:41+00:00

If statement works fine. It’s code is shown below if (getInput1.getText() != null) {

  • 0

If statement works fine. It’s code is shown below

if (getInput1.getText() != null) {
   float answer2 = Float.valueOf(getInput2.getText().toString());
   float answer3 = Float.valueOf(getInput3.getText().toString());
   float answer= answer2/answer3;
   textOut1.setText(String.valueOf(answer));
}

but then I add second if statement (code below)

EditText getInput1 = (EditText) findViewById(R.id.etInput1);
EditText getInput2 = (EditText) findViewById(R.id.etInput2);
EditText getInput3 = (EditText) findViewById(R.id.etInput3);                

if (getInput1.getText() != null) {
   float  answer2 = Float.valueOf(getInput2.getText().toString());
   float answer3 = Float.valueOf(getInput3.getText().toString());
   float answer= answer2/answer3;
   textOut1.setText(String.valueOf(answer));
}                   

if (getInput2.getText()!= null ){       
   float answer1 = Float.valueOf(getInput1.getText().toString());
   float answer3 = Float.valueOf(getInput3.getText().toString());
   float answer= answer1*answer3;
   textOut1.setText(String.valueOf(answer));
} 

logCat says that something goes wrong with valueOf function. Where could be a mistake?

logcat shows:

08-18 17:10:28.918: INFO/ActivityManager(569): Displayed activity com.easyPhys.start/.mechanics: 261 ms
08-18 17:10:29.648: INFO/ActivityManager(569): Starting activity: Intent { action=com.easyPhys.start.velocity comp={com.easyPhys.start/com.easyPhys.start.velocity} }
08-18 17:10:30.008: INFO/ActivityManager(569): Displayed activity com.easyPhys.start/.velocity: 366 ms
08-18 17:10:47.308: WARN/KeyCharacterMap(755): No keyboard for id 0
08-18 17:10:47.308: WARN/KeyCharacterMap(755): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
08-18 17:10:48.338: DEBUG/dalvikvm(704): GC freed 971 objects / 73712 bytes in 126ms
08-18 17:10:51.348: DEBUG/AndroidRuntime(755): Shutting down VM
08-18 17:10:51.348: WARN/dalvikvm(755): threadid=3: thread exiting with uncaught exception (group=0x4000fe70)
08-18 17:10:51.348: ERROR/AndroidRuntime(755): Uncaught handler: thread main exiting due to uncaught exception
08-18 17:10:51.368: ERROR/AndroidRuntime(755): java.lang.NumberFormatException: 
08-18 17:10:51.368: ERROR/AndroidRuntime(755):     at org.apache.harmony.luni.util.FloatingPointParser.parseFloat(FloatingPointParser.java:296)
08-18 17:10:51.368: ERROR/AndroidRuntime(755):     at java.lang.Float.parseFloat(Float.java:327)
08-18 17:10:51.368: ERROR/AndroidRuntime(755):     at com.easyPhys.start.velocity$1.onClick(velocity.java:86)
08-18 17:10:51.368: ERROR/AndroidRuntime(755):     at android.view.View.performClick(View.java:2179)
08-18 17:10:51.368: ERROR/AndroidRuntime(755):     at android.view.View.onTouchEvent(View.java:3828)
08-18 17:10:51.368: ERROR/AndroidRuntime(755):     at android.widget.TextView.onTouchEvent(TextView.java:6291)
08-18 17:10:51.368: ERROR/AndroidRuntime(755):     at android.view.View.dispatchTouchEvent(View.java:3368)
08-18 17:10:51.368: ERROR/AndroidRuntime(755):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:863)
08-18 17:10:51.368: ERROR/AndroidRuntime(755):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:863)
08-18 17:10:51.368: ERROR/AndroidRuntime(755):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:863)
08-18 17:10:51.368: ERROR/AndroidRuntime(755):     at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1707)
08-18 17:10:51.368: ERROR/AndroidRuntime(755):     at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1197)
08-18 17:10:51.368: ERROR/AndroidRuntime(755):     at android.app.Activity.dispatchTouchEvent(Activity.java:1993)
08-18 17:10:51.368: ERROR/AndroidRuntime(755):     at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1691)
08-18 17:10:51.368: ERROR/AndroidRuntime(755):     at android.view.ViewRoot.handleMessage(ViewRoot.java:1525)
08-18 17:10:51.368: ERROR/AndroidRuntime(755):     at android.os.Handler.dispatchMessage(Handler.java:99)
08-18 17:10:51.368: ERROR/AndroidRuntime(755):     at android.os.Looper.loop(Looper.java:123)
08-18 17:10:51.368: ERROR/AndroidRuntime(755):     at android.app.ActivityThread.main(ActivityThread.java:3948)
08-18 17:10:51.368: ERROR/AndroidRuntime(755):     at java.lang.reflect.Method.invokeNative(Native Method)
08-18 17:10:51.368: ERROR/AndroidRuntime(755):     at java.lang.reflect.Method.invoke(Method.java:521)
08-18 17:10:51.368: ERROR/AndroidRuntime(755):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:782)
08-18 17:10:51.368: ERROR/AndroidRuntime(755):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
08-18 17:10:51.368: ERROR/AndroidRuntime(755):     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-05-24T20:32:42+00:00Added an answer on May 24, 2026 at 8:32 pm

    If something is wrong with the Float.ValueOf method you should get a NumberFormatException. So the value you put in ValueOf() could not be converted to a float

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

Sidebar

Related Questions

If I created a Linq statement as shown below, it works fine. var Jobs
Ok, I'm working on a simple statement code and it works fine as long
I have written a printf() statement like below: printf(hello\n); this works fine when built
in the python console the following statement works perfectly fine (i guess using eval
I have some SQL that does an order by case statement. It works fine.
this code works fine: procedure TForm2.Timer1Timer(Sender: TObject); var Text: string; begin SetLength (Text,555); GetWindowText
The following statement BACKUP LOG [AMS_Prod_log] WITH TRUNCATE_ONLY works fine in SQL Server 2005
I have the following statement, and it works fine, except for the fact that
Why this code works fine: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString
I have this MySQL statement which works fine: SELECT claim_items.item_id, claim_items.quantity*items_rate.rate as per_item FROM

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.