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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T11:21:52+00:00 2026-06-09T11:21:52+00:00

i have to write above code in my button click event. webservice working fine.webservice

  • 0

i have to write above code in my button click event. webservice working fine.webservice method return a String. thatString is equal to success go to next layout.it’s working fine. but else part not working. toast make a exception

final SoapSerializationEnvelope envelope1 = new SoapSerializationEnvelope(SoapEnvelope.VER11);
            envelope1.setOutputSoapObject(request1);

          //msg.setText("hi");
            envelope1.dotNet = true;


            final Thread webser=new Thread(){
                public void run()
                {
                    try {
                        HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
                        System.out.println("four and Object value is : " +androidHttpTransport);
                        System.out.println("four and URL : " +URL);
                        //this is the actual part that will call the webservice

                        androidHttpTransport.call(SOAP_ACTION, envelope1);

                        System.out.println("four a");
                        // Get the SoapResult from the envelope body.   

                        SoapObject result1 = (SoapObject)envelope1.bodyIn;



                        if(result1 != null)
                        {
                              //Get the first property and change the label text


                            status=result1.getProperty(0).toString();
                            if(status.equalsIgnoreCase("success"))
                            {

                                Intent home=new Intent(LoginActivity.this,MainActivity.class);
                                startActivity(home);

                            }
                            else                                

                            {  
                                Thread.sleep(1000);


                            Toast.makeText(LoginActivity.this,"Enter Valid Username/Password", Toast.LENGTH_LONG).show();
                             }


                        }


                        else
                        {

                             System.out.println("nodata");
                        }
                  } catch (Exception e) {
                        e.printStackTrace();
                        System.out.println("Exception" +e);
                  }
                }


            };
            webser.start();  




        }
    });
  • 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-09T11:21:53+00:00Added an answer on June 9, 2026 at 11:21 am

    You are accessing UI from back ground thread. To modife UI from Thread Use like this..

    LoginActivity.this.runOnUiThread(new run Runnable() {
    
            @Override
            public void run() {
                Toast.makeText(LoginActivity.this,"Enter Valid Username/Password", Toast.LENGTH_LONG).show();
    
            }
        });
    

    And do not catch (Exception e). It is bad programming practice. 🙂

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

Sidebar

Related Questions

I have following code in button click Response.Write(window.open('Contact.aspx')); The above code is working.but if
I have write this code but it does work only if I am already
I'm working on an application so i have write an dll which contain a
I created sample tableview application and I have an add button above the tableview,
I am wring a button control like below. i have got a method that
I have a piece of code written using VS 2005 that works fine in
We usually write a click handler on a button (in GWT or Swing or
I have write my own view Bar, which extends LinearLayout . My bar has
I am trying to check if I have write access to a specific key
I'm writing a simple web app in PHP that needs to have write access

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.