Created
January 29, 2019 18:15
-
-
Save mahimrocky/02658ba81f9954eaa11b0e2d0940447a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void registerProcess() { | |
StringRequest stringRequest=new StringRequest(Request.Method.POST, registerrequesturl, | |
new Response.Listener<String>() { | |
@Override | |
public void onResponse(String response) { | |
try { | |
JSONObject jsonObject=new JSONObject(response); | |
String result=jsonObject.getString("result"); | |
if(result.equals("Success")){ | |
Toast.makeText(MainActivity.this,"You registered"+result,Toast.LENGTH_LONG).show(); | |
} | |
else{ | |
Toast.makeText(MainActivity.this,"Error Occured"+result,Toast.LENGTH_LONG).show(); | |
} | |
} catch (JSONException e) { | |
e.printStackTrace(); | |
} | |
} | |
}, new Response.ErrorListener() { | |
@Override | |
public void onErrorResponse(VolleyError error) { | |
Toast.makeText(MainActivity.this,"Error Occured"+error.toString(),Toast.LENGTH_LONG).show(); | |
} | |
}) | |
{ | |
@Override | |
public byte[] getBody() throws AuthFailureError { | |
JSONObject params = new JSONObject(); | |
try { | |
params.put("id",2+""); | |
params.put("ownerName","alu"); | |
params.put("presentAddress","dhaka"); | |
params.put("ownerMobile",123+""); | |
params.put("ownerEmail","@gmail"); | |
params.put("religion","islam"); | |
params.put("professsion","eng"); | |
params.put("professsionDetails","ghj"); | |
params.put("professsionAddress","ku"); | |
params.put("jobPreference","wed"); | |
params.put("jobLocation","kh"); | |
params.put("carName","bw"); | |
params.put("startDate","5/5/7"); | |
params.put("offerSalary",233+""); | |
params.put("education","ssc"); | |
params.put("expYear","3yr"); | |
params.put("accomodation","vitaa"); | |
params.put("workingHours",34+""); | |
params.put("lunch","money"); | |
params.put("status","good"); | |
params.put("remarks","goood"); | |
params.put("userName","alamin "+System.currentTimeMillis()); | |
} catch (JSONException e) { | |
e.printStackTrace(); | |
} | |
return params.toString().getBytes(); | |
} | |
@Override | |
public String getBodyContentType() { | |
return "application/json; charset=utf-8"; | |
} | |
}; | |
RequestQueue requestQueue=Volley.newRequestQueue(MainActivity.this); | |
requestQueue.add(stringRequest); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment