I am using SQL for my database. I have cross-verified all names of the variables and parameters they are correct. I have cross-verified my PHP script using postman snd I am getting the correct output but when moving on to send data from the mobile I am getting the mentioned error.
Following is my android code...
package com.example.researchprojectv2;
import androidx.appcompat.app.AppCompatActivity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import com.android.volley.AuthFailureError;
import com.android.volley.DefaultRetryPolicy;
import com.android.volley.Request;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.StringRequest;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.HashMap;
import java.util.Map;
public class MainActivity extends AppCompatActivity {
private EditText emp_ID, password;
private Button btn_submit;
private TextView txt;
private ProgressDialog progressDialog;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
emp_ID = findViewById(R.id.editTextNumber);
password = findViewById(R.id.editTextTextPassword);
btn_submit = findViewById(R.id.button);
txt = findViewById(R.id.login);
progressDialog = new ProgressDialog(this);
txt.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(MainActivity.this, Login.class);
startActivity(intent);
}
});
btn_submit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
registerUser();
progressDialog.show();
progressDialog.setTitle("Please while registering");
}
});
}
private void registerUser() {
final String empID = emp_ID.getText().toString().trim();
final String passWD = password.getText().toString().trim();
progressDialog.setMessage("Registering User....");
StringRequest stringRequest = new StringRequest(Request.Method.POST,
Constants.URL_REGISTER,
new Response.Listener<String>() {
@Override
public void onResponse(String response) {
progressDialog.hide();
try {
JSONObject jsonObject = new JSONObject(response);
Toast.makeText(getApplicationContext(), jsonObject.getString(
"message"), Toast.LENGTH_LONG).show();
Intent intent = new Intent(MainActivity.this, hhh.class);
startActivity(intent);
} catch (JSONException e) {
e.printStackTrace();
}
}
},
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Toast.makeText(getApplicationContext(), error.toString(), Toast.LENGTH_LONG).show();
progressDialog.hide();
}
}) {
@Override
protected Map<String, String> getParams() {
Map<String, String> params = new HashMap<>();
params.put("emp_id", empID);
params.put("password", passWD);
return params;
}
};
//200000 is the time in milliseconds adn is equal to 200 sec
stringRequest.setRetryPolicy(new DefaultRetryPolicy(
200000,
DefaultRetryPolicy.DEFAULT_MAX_RETRIES,
DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
RequestHandler.getInstance(this).addToRequestQueue(stringRequest);
}
}
log report (android studio)
07/05 02:39:47: Launching 'app' on Xiaomi Redmi Note 7 Pro.
$ adb shell am start -n "com.example.researchprojectv2/com.example.researchprojectv2.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Connected to process 30174 on device 'xiaomi-redmi_note_7_pro-5a14c494'.
Capturing and displaying logcat messages from application. This behavior can be disabled in the "Logcat output" section of the "Debugger" settings page.
I/searchprojectv: Late-enabling -Xcheck:jni
W/searchprojectv: miui_dex2oat: DeoptimizeBootImage: patch entry points of methods in boot image to interpreter bridge
W/searchprojectv: miui_dex2oat: oat file of /data/app/com.example.researchprojectv2-iamCClGDbdwVn_WQyjaUJQ==/base.apk is not exists
W/searchprojectv: miui_dex2oat: /data/app/com.example.researchprojectv2-iamCClGDbdwVn_WQyjaUJQ==/base.apk: Fall back to running out of the original dex file.
I/Perf: Connecting to perf service.
W/searchprojectv: Accessing hidden method Landroid/graphics/drawable/Drawable;->getOpticalInsets()Landroid/graphics/Insets; (light greylist, linking)
Accessing hidden field Landroid/graphics/Insets;->left:I (light greylist, linking)
Accessing hidden field Landroid/graphics/Insets;->right:I (light greylist, linking)
Accessing hidden field Landroid/graphics/Insets;->top:I (light greylist, linking)
Accessing hidden field Landroid/graphics/Insets;->bottom:I (light greylist, linking)
W/searchprojectv: Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (light greylist, reflection)
W/searchprojectv: Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (light greylist, reflection)
W/searchprojectv: Accessing hidden method Landroid/widget/TextView;->getTextDirectionHeuristic()Landroid/text/TextDirectionHeuristic; (light greylist, linking)
I/Adreno: QUALCOMM build : 89f10b9, I3d0e3ac366
Build Date : 12/25/18
OpenGL ES Shader Compiler Version: EV031.25.14.03
Local Branch :
Remote Branch :
Remote Branch :
Reconstruct Branch :
Build Config : S P 6.0.9 AArch64
I/Adreno: PFP: 0x016ee177, ME: 0x00000000
I/ConfigStore: android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasWideColorDisplay retrieved: 0
android::hardware::configstore::V1_0::ISurfaceFlingerConfigs::hasHDRDisplay retrieved: 0
I/OpenGLRenderer: Initialized EGL, version 1.4
D/OpenGLRenderer: Swap behavior 2
E/LB: fail to open file: No such file or directory
I/DpmTcmClient: RegisterTcmMonitor from: $Proxy0
D/NetworkSecurityConfig: Using Network Security Config from resource network_security_config debugBuild: true
E/VOLLEY: com.android.volley.NoConnectionError: java.io.IOException: unexpected end of stream on com.android.okhttp.Address@bb6309b9
I/Toast: Show toast from OpPackageName:com.example.researchprojectv2, PackageName:com.example.researchprojectv2
I/searchprojectv: ProcessProfilingInfo new_methods=1150 is saved saved_to_disk=1 resolve_classes_delay=8000
User contributions licensed under CC BY-SA 3.0