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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T22:37:16+00:00 2026-06-05T22:37:16+00:00

I using a web services to get the value, make the long story short.

  • 0

I using a web services to get the value, make the long story short. I can get the value from webservices, for this case, the value for strVersion is 1(the for loop only return 1 record since there is only 1 record).

Now here is the problem, the result always return “Wrong: 1” instead of “OK: 1”, come someone please tell me why? the datatype in MYSQL for this field is Varchar.

    AndroidHttpTransport aht = new AndroidHttpTransport(URL);
    aht.call(SOAP_ACTION, soapEnvelope);
    SoapObject resultString = (SoapObject) soapEnvelope.getResponse();

    final String[] strVersion = new String[resultString.getPropertyCount()];

    for(int i =0; i<resultString.getPropertyCount(); i++)
    {
        SoapObject array = (SoapObject) resultString .getProperty(i);
        strVersion[i] = array.getProperty(0).toString();                    
        if(strVersion[i] == "1")
        {
        Toast.makeText(getApplicationContext(), "OK: " + strVersion[i], Toast.LENGTH_SHORT).show();
        }
        else
        {
             Toast.makeText(getApplicationContext(), "Wrong: " + strVersion[i], Toast.LENGTH_SHORT).show();
        }
    }
  • 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-05T22:37:20+00:00Added an answer on June 5, 2026 at 10:37 pm

    Do String comparison using equals().

    Change this:

    if(strVersion[i] == "1")
    

    to

    if(strVersion[i].equals("1"))
    

    Read this for more information.

    == compares references,not the values. In your case, you want to check for the value equality, not the reference equality.

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

Sidebar

Related Questions

I am using JQGrid to get the date from the RESTFul web services that
I am using Exchange Web Services to try to get a list of all
I am trying to access Folder from Document Library using web services in C#.
I have this web service : using System.Web.Services; namespace Contracts { [WebService(Namespace = http://tempuri.org/)]
I'm receiving data from web-services in XML and I'm using that data via objects,
I have a method that I call to make web service requests using GET.
I plan on using JSONP to call an external web service to get around
I am new to using web services. I am assigned a task in which
I m new to using Web services using JavaScript. All I want is to
I am using calling web services and using WCF generated service-reference on the client.

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.