Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by manikanta · Oct 16, 2013 at 09:49 AM · androidruntime-errorlogcat

fatal exception: main in android

main activity: file package com.example.webservicei;

import org.ksoap2.SoapEnvelope; import org.ksoap2.serialization.SoapObject; import org.ksoap2.serialization.SoapSerializationEnvelope; import org.ksoap2.transport.HttpTransportSE;

import android.annotation.SuppressLint; import android.app.Activity; import android.app.ProgressDialog; import android.content.Intent; import android.os.AsyncTask; import android.os.Bundle; import android.os.StrictMode; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import android.widget.Toast;

public class MainActivity extends Activity implements OnClickListener { Button login,logout; ProgressDialog pDialog; SoapObject response = null; String value = "perumal@otr-ict.in",loginResponse; String value1 ="perumal1234",loginResponse1; String value2 = "loginResponse2"; String loginResponse2 = "loginResponse+loginResponse1"; EditText username,password; private static String mNAMESPACE="http://tempuri.org/"; private static String SOAP_ACTION = "http://tempuri.org/ValidateUser"; private static String mURL="http://192.168.0.5:81/GoodListingWebService/service.asmx?op=ValidateUser"; private static String USERNAME="email"; private static String PASSWORD="Password"; private static String METHODNAME="ValidateUser"; public static CharSequence progress_message; public static CharSequence progress_title; @SuppressLint("NewApi") @Override

 protected void onCreate(Bundle savedInstanceState) 
 {
     //super.onCreate(savedInstanceState);
     super.onCreate(savedInstanceState);
     setContentView(R.layout.activity);
     if (android.os.Build.VERSION.SDK_INT > 9) 
     {
         StrictMode.ThreadPolicy policy = 
                 new StrictMode.ThreadPolicy.Builder().permitAll().build();  
         StrictMode.setThreadPolicy(policy);
     }

     login=(Button)findViewById(R.id.login);
     //logout=(Button)findViewById(R.id.login);
     username = (EditText)findViewById(R.id.userbutton);
     password = (EditText)findViewById(R.id.passbutton);

     login.setOnClickListener(this);

// logout.setOnClickListener(this);

 }
 public void onClick(View arg0) 
 {
     switch(arg0.getId()) 
     {

     /*case R.id.logout:

finish();
moveTaskToBack(true); break;*/ case R.id.login: if(username.getText().toString().equalsIgnoreCase("")|| username.getText().toString().equalsIgnoreCase(null)) {

             //Toast.makeText(getApplicationContext(), R.string.usernametoast, Toast.LENGTH_SHORT).show();
         }
         else if
         (password.getText().toString().equalsIgnoreCase("")|| password.getText().toString().equalsIgnoreCase(null))
         {

             //Toast.makeText(getApplicationContext(), R.string.passwordtoast, Toast.LENGTH_SHORT).show();
         }
         else
         {

             //if(ConstantsUsed.isnetworkConnected(getApplicationContext()))



             if(ConstantsUsed.isnetworkConnected(getApplicationContext()))
             {
                 new LoginAsyncTask().execute();
             }
             else
             {
                 Toast.makeText(getApplicationContext(),ConstantsUsed.internet_connection, Toast.LENGTH_LONG).show();
             }
         }
         //    Intent intent = new Intent(LoginPage.this,HomePage.class);
         //    intent.putExtra("mail", username.getText().toString());
         //    startActivity(intent);

         break;
     default:
         break;
     }    
 }

 class LoginAsyncTask extends AsyncTask<String, Void, Void> 
 {
     @Override
     protected void onPreExecute() 
     {
         pDialog = new ProgressDialog(MainActivity.this);
         pDialog.setTitle(MainActivity.progress_title);
         pDialog.setMessage(MainActivity.progress_message);
         pDialog.show();
         super.onPreExecute();
     }
     @Override
     protected Void doInBackground(String... params) 
     {
         SoapObject request = new SoapObject(mNAMESPACE, METHODNAME);       

         //Use this to add parameters
         String userna = username.getText().toString();
         String passw = password.getText().toString();
         request.addProperty(USERNAME,userna);
         request.addProperty(PASSWORD,passw);

         //Declare the version of the SOAP request
         SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);

         envelope.setOutputSoapObject(request);
         envelope.dotNet = true;

         try {
             HttpTransportSE androidHttpTransport = new HttpTransportSE(mURL);

             //this is the actual part that will call the webservice
             androidHttpTransport.call(SOAP_ACTION, envelope);

             // Get the SoapResult from the envelope body
             SoapObject result = (SoapObject)envelope.bodyIn;

             if(result != null)
             {
                 loginResponse = result.getProperty(0).toString();
             }
             else
             {
                 Toast.makeText(getApplicationContext(), "No Response",Toast.LENGTH_LONG).show();
             }
         } catch (Exception e) {
             e.printStackTrace();
         }
         return null;

     }

     @Override
     protected void onPostExecute(Void result) 
     {
         super.onPostExecute(result);
         if (pDialog != null && pDialog.isShowing()) 
         {
             pDialog.dismiss();


             if(loginResponse2.matches("loginResponse"+"loginResponse1"))
                 //if(loginResponse == ("username")) equals (loginResponse1 == ("password"))
                 //if(loginResponse.matches("USERNAME") equals  (loginResponse1.matches("PASSWORD"))
             {
                 Intent i = new Intent(MainActivity.this, ConstantsUsed.class);

                 //    i.putExtra("userna", username.getText().toString());
                 i.putExtra("loginResponse", true);
                 startActivity(i);
             }
             else{

                 Intent i = new Intent(MainActivity.this,ConstantsUsed.class);
                 i.putExtra("loginResponse", false);
                 startActivity(i);

                 Toast.makeText(getApplicationContext(), "username and password was not match", Toast.LENGTH_LONG).show();
             }
             //loginResponse = result.toString().valueOf(true);

             /*if(!loginResponse.equalsIgnoreCase("") )

{*/ /if(result != null) { loginResponse = result.equals(SOAP_ACTION); } else { Toast.makeText(getApplicationContext(), "No Response",Toast.LENGTH_LONG).show(); }/

             if (result != null){
                 result.equals(loginResponse2);

                 loginResponse2 = result.toString().valueOf(true);
                 //    loginResponse = response.getName().toString().valueOf(true);
                 //    loginResponse = result.equals(mURL);
                 //    loginResponse = SOAP_ACTION.toString().valueOf(true);
                 //    loginResponse = result.TYPE.getName().valueOf(true);
                 //    loginResponse = String.valueOf(true);
                 //    loginResponse = result.TYPE.toString().valueOf(true);
                 //    loginResponse = result.toString().valueOf(true);
                 //    loginResponse = result.toString().valueOf(true);
                 //    loginResponse = result.getClass().getName().toString().valueOf(true);
                 //    loginResponse = result.TYPE.getName().valueOf(true);
                 //    loginResponse = response.getName().valueOf(true);
                 //    loginResponse = result.toString().valueOf(true);
                 Toast.makeText(getApplicationContext(), "got response", Toast.LENGTH_LONG).show();
             }
             else {

                 result = null; 
                 //    loginResponse = result.equals(get().toString().valueOf(false));
                 //    loginResponse = SOAP_ACTION.toString().valueOf(false);

                 //    loginResponse = android.widget.AutoCompleteTextView.Validator.class.toString().valueOf(false);
                 //    loginResponse = result.TYPE.toString().valueOf(false);

                 //    loginResponse = result.toString().valueOf(false);
                 //    loginResponse = result.toString().valueOf(false);
                 //    loginResponse = result.getClass().getName().toString().valueOf(false);
                 //    loginResponse = String.valueOf(false);
                 //    loginResponse = result.TYPE.getName().valueOf(false);
                 loginResponse = result.TYPE.getName().valueOf(false);
                 Toast.makeText(getApplicationContext(), "NoResponse", Toast.LENGTH_LONG).show();
             }
             Log.v("@@@@@@@@@@@@@@@@", "loginResponse"+loginResponse);










             /*if(loginResponse.equalsIgnoreCase("True"))

{ Intent intent = new Intent(MainActivity.this,HomePage.class); intent.putExtra("userna", username.getText().toString()); startActivity(intent); } else { Toast.makeText(getApplicationContext(), "Username & Password was Not Match",Toast.LENGTH_LONG).show(); } // Log.v("@@@@@@@@@@@@@@@", "loginResponse"+loginResponse);

if(loginResponse.equalsIgnoreCase("True")) { Intent intent = new Intent(MainActivity.this,ConstantsUsed.class); intent.putExtra("mail", username.getText().toString()); startActivity(intent); }

else { Toast.makeText(getApplicationContext(), "Username & Password was Not Match",Toast.LENGTH_LONG).show(); } }

else { Toast.makeText(getApplicationContext(), "Server Error",Toast.LENGTH_LONG).show(); } }*/ } } } }

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
â–¼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

14 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

App crashes on Android 7.11 2 Answers

What is TA Load in the Android internal profiler? 0 Answers

Android app killed after returning from Unity module 0 Answers

Problems porting a Unity game to android 1 Answer

Solving a crash with help from logcat 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges