There is public website like Google, it receives an ID by user via Form and passes the related data back to user by button click. Website form example screenshot : public site link
Please help me how to implement it in my Android App, so that user could enter their ID and get result in App. my App screenshot
I have tried using Volley Library, but it retrieved only page source code. here is my Code.
private void sendPostRequest() {
RequestQueue requestQueue = Volley.newRequestQueue(DawlatiKonkorResultActivity.this);
String url = "http://kankorafghanistan.com/kankor-results/";
StringRequest stringRequest = new StringRequest(Request.Method.POST, url, new Response.Listener<String>() {
@Override
public void onResponse(String response) {
Log.d("success", "onResponse: success"+response);
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Log.d("failure", "onResponse: success"+error);
}
}){
@Override
protected Map<String, String> getParams(){
Map<String,String> params = new HashMap<>();
params.put("KankorID",editText.getText().toString());
return params;
}
@Override
public Map<String, String> getHeaders() throws AuthFailureError {
Map<String,String> params=new HashMap<String, String>();
params.put("Content-Type","application/x-www-form-urlencoded");
return params;
}
};
requestQueue.add(stringRequest);
}
Aucun commentaire:
Enregistrer un commentaire