How to call JSON Api
Post Response
PostLibResponse.java
Post Listner
LibPostListner.java
Calling API
private PostLibResponse postRequest;
static final int REQUEST_CODE = 1
Map<String, String> parmas = new HashMap<>();
parmas.put("user_id", userId);
postRequest = new PostLibResponse(EntertainmentActivity.this, new EntertainmentDataModel(), EntertainmentActivity.this, parmas, URL, REQUEST_CODE);
@Override
public void onPostResponseComplete(Object clsGson, int requestCode) {
dismissProgress();
if (requestCode == REQUEST_CODE) {
if (clsGson != null) {
mDataModel = (DataModel) clsGson;
if () {
success
} else {
error
}
} else {
alertError("Something is wrong");
}
}
}
@Override
public void onPostResponseError(String errorMessage, int requestCode) {
dismissProgress();
if (requestCode == REQUEST_CODE) {
alertError(errorMessage);
}
}
Post Response
PostLibResponse.java
Post Listner
LibPostListner.java
Calling API
private PostLibResponse postRequest;
static final int REQUEST_CODE = 1
Map<String, String> parmas = new HashMap<>();
parmas.put("user_id", userId);
postRequest = new PostLibResponse(EntertainmentActivity.this, new EntertainmentDataModel(), EntertainmentActivity.this, parmas, URL, REQUEST_CODE);
@Override
public void onPostResponseComplete(Object clsGson, int requestCode) {
dismissProgress();
if (requestCode == REQUEST_CODE) {
if (clsGson != null) {
mDataModel = (DataModel) clsGson;
if () {
success
} else {
error
}
} else {
alertError("Something is wrong");
}
}
}
@Override
public void onPostResponseError(String errorMessage, int requestCode) {
dismissProgress();
if (requestCode == REQUEST_CODE) {
alertError(errorMessage);
}
}
Comments
Post a Comment