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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T16:36:18+00:00 2026-06-06T16:36:18+00:00

This code is throwing a invocationTargetException. There are a few problems with this code:

  • 0

This code is throwing a invocationTargetException.
There are a few problems with this code:

  1. It is still entering the if statement even though I specifically told it not too when nothing is input into the EditText.
  2. I am guessing the exception could have occurred because of the parseInt not having anything to parse (Although that shouldn’t be a problem).
  3. A cause of this type exception should be not initiating something at the right time, should it not?

    if(ageText.getText().toString() != "" || ageText.getText().toString() != null)
    {
        newCharacterController.characterAge = Integer.parseInt(ageText.getText().toString());
    }
    

A little off topic too, I cant seem to find the tag of any of the containers like a Spinner or EditText, when I look into the mTag value of it when the program is running, will this affect my if(parent.getTag() == "OBJECTIDGIVENBYMYSELF") and stop if from working? Also is there a better way to gain the tag value (.getType() in C#).

An example of the above OBJECTNAMEGIVENBYMYSELF is EditText ***newEditText*** = new EditText(this);.

  • 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-06T16:36:19+00:00Added an answer on June 6, 2026 at 4:36 pm
    ageText.getText().toString() != ""
    

    The above code is not a good practice to compare String content, simply because comparison operator such as “==” is used to compare by reference but not value. I think you should use the following code instead

    ageText.getText().toString().equals("")
    

    And by the way, check null before this.

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

Sidebar

Related Questions

why is this code throwing an out of memory error, when there is only
This code is throwing the following error in IE, but not in any other
Why is this code throwing up a SIGSEGV : int main() { unsigned long
Why is this code throwing an exception? var dateTime = 2012-03-21_15.12; var format =
I can't understand why this code is throwing exception of Bad Access: - (void)viewDidLoad
This code of mine keeps on throwing error i don't understand why. var id
The following code is throwing the error this.element is null. However, the wid_cont is
I have a bit of sample code that is throwing this warning: main.c: In
I've seen the code examples on this article , but throwing Controller_Exception_404 produces an
I've got this code throwing an error from an iframe: function parentIframeResize() { var

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.