Я хочу отобразить ответ, полученный от кода PHP. Мой PHP код:
if ($query) {
$response['message'] = "Saved";
$response['error'] = false;
} else {
$response['message'] = "Not Saved";
$response['error'] = true;
}
echo json_encode($response);
Я хочу отобразить сообщение об ошибке и активность
Мой java код:
Call<String> call = updateInterface.updateData(getId, studentData[0], studentData[1], studentData[2]);
call.enqueue(new Callback<String>() {
@Override
public void onResponse(Call<String> call, Response<String> response) {
editPrg.dismiss();
Toast.makeText(getApplicationContext(), "Record updated", Toast.LENGTH_LONG).show();
}
@Override
public void onFailure(Call<String> call, Throwable throwable) {
//hide dialog
editPrg.dismiss();
Toast.makeText(getApplicationContext(), "Error updating record", Toast.LENGTH_LONG).show();
}
});
Я хочу отобразить PHP ответ в методе onResponse (). Пожалуйста, наведите меня, что мне делать?