private Handler handler = new Handler(Looper.getMainLooper());
JSONObject objInfo = new JSONObject();
JSONObject objInfoData = new JSONObject(); objInfoData.put("offlineshopid",iGlobalParams.Offline_Shopid);
objInfoData.put("onSell", "0");
objInfoData.put("pageNow", String.valueOf(pageIndex));
objInfoData.put("pageSize", String.valueOf(10));
objInfo.put("data", objInfoData);
objInfo.put("token", iGlobalParams.TOKEN);
OkHttpClient http = new OkHttpClient();
MediaType JSON = MediaType.parse("application/json; charset=utf-8");
RequestBody body = RequestBody.create(JSON, objInfo.toString());
Request request = new Request. Builder().url(CommonUrl.PRODUCT).post(body).build();
Call call = http.newCall(request );
call.enqueue(new Callback() {
@Override
public void onResponse(Call arg0, Response arg1) throws IOException {
final String res = arg1.body().string();
handler.post(new Runnable() {
@Override
public void run() {
}
});
@Override
public void onFailure(Call arg0, IOException arg1) {
handler.post(new Runnable() {
@Override
public void run() {
}
});
}