xml error will now trigger red toast
This commit is contained in:
parent
34ef339069
commit
a8e4d29c5b
@ -21,6 +21,7 @@ import com.example.aped.MainActivity;
|
||||
import com.example.aped.R;
|
||||
import com.example.aped.utils.ExternalStorageHandler;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.File;
|
||||
@ -112,7 +113,16 @@ public class Communicator {
|
||||
Request.Method.POST,
|
||||
url,
|
||||
xmlFile,
|
||||
response -> System.out.println(response.toString()),
|
||||
response -> {
|
||||
try {
|
||||
JSONObject jsonObject = new JSONObject(response.toString());
|
||||
if (!jsonObject.getString("error").equals("")) {
|
||||
makeToast(jsonObject.getString("error"));
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
Log.e("Communicator","JSON error on response during UPLOAD: " + e.getMessage());
|
||||
}
|
||||
},
|
||||
error -> handleError(error, "UPLOAD XML")
|
||||
);
|
||||
requestQueue.add(request);
|
||||
|
Loading…
x
Reference in New Issue
Block a user