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 {
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);
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);
register.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
CheckEditTextIsEmptyOrNot();
if(CheckEditText){
UserRegisterFunction(F_Name_Holder,L_Name_Holder, EmailHolder, PasswordHolder);
}
else {
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);
}
}