Please help me how to put data to JSON and toast it when I press share key in my code. My problem is when I press the share button it toasts:
Physician key :
patient key :5010
I am not able to pass the physician key value in this put method and my physician key is also not showing even though I store it in a string and pass it .
public class SendPostRequest extends AsyncTask<String, Void, String> {
protected void onPreExecute(){}
protected String doInBackground(String... arg0) {
try {
URL url = new URL("xyz.com/data/abc.physicinlist"); // here is your URL path
final JSONObject postDataParams = new JSONObject();
/* postDataParams.put("name", "abc");
postDataParams.put("email", "abc@gmail.com");*/
// Getting JSON Array node
JSONArray ary = postDataParams.getJSONArray("physicianlist");
***postDataParams.put("physiciankey", Physician_key);
postDataParams.put("PatientKey", "5010");***
runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(MainActivity.this, postDataParams.toString(), Toast.LENGTH_SHORT).show();
}
});