我在android studio中遇到错误 [英] I am getting errors in android studio

查看:188
本文介绍了我在android studio中遇到错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello Guys我在android studio中遇到此错误我的应用程序自动关闭且无法与mysql连接



Hello Guys am getting this errors in android studio my app automatically closed and can't be connect with mysql

01/01 11:42:06: Launching app
    No apk changes detected since last installation, skipping installation of C:\Users\SAJID\Desktop\ComplainProtectionCell3\ComplainProtectionCell\app\build\outputs\apk\app-debug.apk
    $ adb shell am force-stop com.example.sajid.complainprotectioncell
    $ adb shell am start -n "com.example.sajid.complainprotectioncell/com.example.sajid.complainprotectioncell.Register" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
    Client not ready yet..Waiting for process to come online
    Waiting for process to come online
    Connected to process 5976 on device emulator-5554
    I/art: Ignoring second debugger -- accepting and dropping
    Application terminated.





我尝试过:





What I have tried:

package com.example.sajid.complainprotectioncell;

import android.app.ProgressDialog;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

import java.util.HashMap;


public class Register extends AppCompatActivity {
//    public static final String URL = "https://interactivebookfyp.000webhostapp.com/user/signUp.php";
//    AsyncHttpClient client = new AsyncHttpClient();

    Button register, log_in;
    EditText U_Name, Email, Password,Cnic,Phone ;
    String F_Name_Holder, L_Name_Holder, EmailHolder, PasswordHolder;
    String finalResult ;
    String HttpURL = "https://localhost:83/panel/UserRegistration.php";
    Boolean CheckEditText ;
    ProgressDialog progressDialog;
    HashMap<String,String> hashMap = new HashMap<>();
    HttpParse httpParse = new HttpParse();


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.register);

        //Assign Id'S
        U_Name = (EditText)findViewById(R.id.input_name);
        Email = (EditText)findViewById(R.id.input_email);
        Password = (EditText)findViewById(R.id.input_password);
        Cnic = (EditText)findViewById(R.id.input_cnic);
        Phone= (EditText)findViewById(R.id.input_phone);
        register = (Button)findViewById(R.id.BtnGo);

        log_in = (Button)findViewById(R.id.login);

        //Adding Click Listener on button.
        register.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

                // Checking whether EditText is Empty or Not
                CheckEditTextIsEmptyOrNot();

                if(CheckEditText){

                    // If EditText is not empty and CheckEditText = True then this block will execute.

                    UserRegisterFunction(F_Name_Holder,L_Name_Holder, EmailHolder, PasswordHolder);

                }
                else {

                    // If EditText is empty then this block will execute .
                    Toast.makeText(Register.this, "Please fill all form fields.", Toast.LENGTH_LONG).show();

                }


            }
        });

        log_in.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

                Intent intent = new Intent(Register.this,Login.class);
                startActivity(intent);

            }
        });

    }

    public void CheckEditTextIsEmptyOrNot(){

        F_Name_Holder = U_Name.getText().toString();
        L_Name_Holder = Email.getText().toString();
        EmailHolder = Email.getText().toString();
        PasswordHolder = Password.getText().toString();


        if(TextUtils.isEmpty(F_Name_Holder) || TextUtils.isEmpty(L_Name_Holder) || TextUtils.isEmpty(EmailHolder) || TextUtils.isEmpty(PasswordHolder))
        {

            CheckEditText = false;

        }
        else {

            CheckEditText = true ;
        }
}

    public void UserRegisterFunction(final String F_Name, final String L_Name, final String email, final String password){

        class UserRegisterFunctionClass extends AsyncTask<String,Void,String> {

            @Override
            protected void onPreExecute() {
                super.onPreExecute();

                progressDialog = ProgressDialog.show(Register.this,"Loading Data",null,true,true);
            }

            @Override
            protected void onPostExecute(String httpResponseMsg) {

                super.onPostExecute(httpResponseMsg);

                progressDialog.dismiss();

                Toast.makeText(Register.this,httpResponseMsg.toString(), Toast.LENGTH_LONG).show();

            }

            @Override
            protected String doInBackground(String... params) {

                hashMap.put("U_Name",params[0]);

                hashMap.put("Email",params[1]);

                hashMap.put("Password",params[2]);

                hashMap.put("Cnic",params[3]);

                hashMap.put("Phone",params[3]);

                finalResult = httpParse.postRequest(hashMap, HttpURL);

                return finalResult;
            }
        }

        UserRegisterFunctionClass userRegisterFunctionClass = new UserRegisterFunctionClass();

        userRegisterFunctionClass.execute(F_Name,L_Name,email,password);
    }

}

推荐答案

adb shell am force-stop com.example.sajid。抱怨保护单元
adb shell am force-stop com.example.sajid.complainprotectioncell


adb shell am start -ncom.example.sajid.complainprotectioncell / com.example.sajid.complainprotectioncell.Register-a android.intent.action.MAIN -c android。 intent.category.LAUNCHER
客户尚未准备就绪..等待流程上线
等待流程上线
连接到设备模拟器上的流程5976-5554
I / art:忽略第二个调试器 - 接受和删除
应用程序终止。
adb shell am start -n "com.example.sajid.complainprotectioncell/com.example.sajid.complainprotectioncell.Register" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER Client not ready yet..Waiting for process to come online Waiting for process to come online Connected to process 5976 on device emulator-5554 I/art: Ignoring second debugger -- accepting and dropping Application terminated.





我尝试了什么:





What I have tried:

package com.example.sajid.complainprotectioncell;

import android.app.ProgressDialog;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

import java.util.HashMap;


public class Register extends AppCompatActivity {
//    public static final String URL = "https://interactivebookfyp.000webhostapp.com/user/signUp.php";
//    AsyncHttpClient client = new AsyncHttpClient();

    Button register, log_in;
    EditText U_Name, Email, Password,Cnic,Phone ;
    String F_Name_Holder, L_Name_Holder, EmailHolder, PasswordHolder;
    String finalResult ;
    String HttpURL = "https://localhost:83/panel/UserRegistration.php";
    Boolean CheckEditText ;
    ProgressDialog progressDialog;
    HashMap<String,String> hashMap = new HashMap<>();
    HttpParse httpParse = new HttpParse();


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.register);

        //Assign Id'S
        U_Name = (EditText)findViewById(R.id.input_name);
        Email = (EditText)findViewById(R.id.input_email);
        Password = (EditText)findViewById(R.id.input_password);
        Cnic = (EditText)findViewById(R.id.input_cnic);
        Phone= (EditText)findViewById(R.id.input_phone);
        register = (Button)findViewById(R.id.BtnGo);

        log_in = (Button)findViewById(R.id.login);

        //Adding Click Listener on button.
        register.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

                // Checking whether EditText is Empty or Not
                CheckEditTextIsEmptyOrNot();

                if(CheckEditText){

                    // If EditText is not empty and CheckEditText = True then this block will execute.

                    UserRegisterFunction(F_Name_Holder,L_Name_Holder, EmailHolder, PasswordHolder);

                }
                else {

                    // If EditText is empty then this block will execute .
                    Toast.makeText(Register.this, "Please fill all form fields.", Toast.LENGTH_LONG).show();

                }


            }
        });

        log_in.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

                Intent intent = new Intent(Register.this,Login.class);
                startActivity(intent);

            }
        });

    }

    public void CheckEditTextIsEmptyOrNot(){

        F_Name_Holder = U_Name.getText().toString();
        L_Name_Holder = Email.getText().toString();
        EmailHolder = Email.getText().toString();
        PasswordHolder = Password.getText().toString();


        if(TextUtils.isEmpty(F_Name_Holder) || TextUtils.isEmpty(L_Name_Holder) || TextUtils.isEmpty(EmailHolder) || TextUtils.isEmpty(PasswordHolder))
        {

            CheckEditText = false;

        }
        else {

            CheckEditText = true ;
        }
}

    public void UserRegisterFunction(final String F_Name, final String L_Name, final String email, final String password){

        class UserRegisterFunctionClass extends AsyncTask<String,Void,String> {

            @Override
            protected void onPreExecute() {
                super.onPreExecute();

                progressDialog = ProgressDialog.show(Register.this,"Loading Data",null,true,true);
            }

            @Override
            protected void onPostExecute(String httpResponseMsg) {

                super.onPostExecute(httpResponseMsg);

                progressDialog.dismiss();

                Toast.makeText(Register.this,httpResponseMsg.toString(), Toast.LENGTH_LONG).show();

            }

            @Override
            protected String doInBackground(String... params) {

                hashMap.put("U_Name",params[0]);

                hashMap.put("Email",params[1]);

                hashMap.put("Password",params[2]);

                hashMap.put("Cnic",params[3]);

                hashMap.put("Phone",params[3]);

                finalResult = httpParse.postRequest(hashMap, HttpURL);

                return finalResult;
            }
        }

        UserRegisterFunctionClass userRegisterFunctionClass = new UserRegisterFunctionClass();

        userRegisterFunctionClass.execute(F_Name,L_Name,email,password);
    }

}


这篇关于我在android studio中遇到错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆