本文整理汇总了Java中com.lidroid.xutils.http.RequestParams.addQueryStringParameter方法的典型用法代码示例。如果您正苦于以下问题:Java RequestParams.addQueryStringParameter方法的具体用法?Java RequestParams.addQueryStringParameter怎么用?Java RequestParams.addQueryStringParameter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.lidroid.xutils.http.RequestParams
的用法示例。
在下文中一共展示了RequestParams.addQueryStringParameter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDetails
import com.lidroid.xutils.http.RequestParams; //导入方法依赖的package包/类
void getDetails(int donationId){
RequestParams params = new RequestParams();
params.addHeader("authorization", loginData.getToken());
params.addQueryStringParameter("love_id", donationId + "");
HttpUtils httpUtils = new HttpUtils();
httpUtils.configCurrentHttpCacheExpiry(1000);
httpUtils.send(HttpRequest.HttpMethod.GET, ApiStores.getDonationDetail, params, new RequestCallBack<String>() {
@Override
public void onSuccess(com.lidroid.xutils.http.ResponseInfo<String> responseInfo) {
donation = new Gson().fromJson(responseInfo.result, RequestDonation.class).data;
initViews();
}
@Override
public void onFailure(HttpException e, String s) {
Toast.makeText(context, "请求失败", Toast.LENGTH_SHORT).show();
Log.e("aaa", e.getMessage());
Log.e("aaa", s);
}
});
}
示例2: getJokeList
import com.lidroid.xutils.http.RequestParams; //导入方法依赖的package包/类
public static void getJokeList(final boolean isRefresh, final int page){
String url = "http://apis.baidu.com/showapi_open_bus/showapi_joke/joke_text";
RequestParams params= new RequestParams();
params.addHeader("apikey", Const.API_KEY);
params.addQueryStringParameter("page", String.valueOf(page));
HttpUtils http = new HttpUtils(10000);
http.send(HttpMethod.GET, url, params, new RequestCallBack<String>() {
@Override
public void onSuccess(ResponseInfo<String> responseInfo) {
Log.i("笑话", responseInfo.result);
Vector<TextJokeEntity> jokeList = JokeParse.parse(responseInfo.result);
Intent intent = new Intent(Const.ACTION_GET_JOKE);
intent.putExtra(Const.KEY_STATUS, Const.GET_JOKE_SUCCESS);
intent.putExtra("isRefresh", isRefresh);
intent.putExtra("jokeList", jokeList);
BaseApplication.getInstance().sendBroadcast(intent);
}
@Override
public void onFailure(HttpException e, String s) {
Log.i("笑话获取失败", e.getMessage() + "");
}
});
}
示例3: getAddressInfo
import com.lidroid.xutils.http.RequestParams; //导入方法依赖的package包/类
/**
* 从服务端获取当前用户的所有地址信息
*/
public void getAddressInfo(){
RequestParams params=new RequestParams();
String username=AppApplication.getApp().getUsername();
params.addQueryStringParameter("params", "{\"username\":\"" + username
+ "\"}");
httpUtils.send(HttpMethod.POST,NoChange.SELECT_ADDRESSLIST,params,new RequestCallBack<String>() {
public void onSuccess(ResponseInfo<String> responseInfo) {
Gson gson =new Gson();
datas=gson.fromJson(responseInfo.result,new TypeToken<List<AddressInfo>>(){}.getType());
adapter=new EditAddressListAdapter(datas,EditAddressList.this);
listview.setAdapter(adapter);
}
public void onFailure(HttpException error, String msg) {
}
});
}
示例4: getAddressInfo
import com.lidroid.xutils.http.RequestParams; //导入方法依赖的package包/类
/**
* 从服务端获取当前用户的所有地址信息
*/
public void getAddressInfo(){
RequestParams params=new RequestParams();
String username=AppApplication.getApp().getUsername();
params.addQueryStringParameter("params", "{\"username\":\"" + username
+ "\"}");
httpUtils.send(HttpMethod.POST,NoChange.SELECT_ADDRESSLIST,params,new RequestCallBack<String>() {
public void onSuccess(ResponseInfo<String> responseInfo) {
Gson gson =new Gson();
datas=gson.fromJson(responseInfo.result,new TypeToken<List<AddressInfo>>(){}.getType());
adapter=new ShowAddressListAdapter(datas,ShowAddressList.this);
listView.setAdapter(adapter);
}
public void onFailure(HttpException error, String msg) {
}
});
}
示例5: updateMySqlShopCar
import com.lidroid.xutils.http.RequestParams; //导入方法依赖的package包/类
/**
* 更新服务器的购物车列表的单个商品数量
* @param goodId 商品Id
* @param goodNum 商品数量
*/
public void updateMySqlShopCar(int goodId,int goodNum){
updateAdapter();
HttpUtils httpUtils=new HttpUtils();
String username=AppApplication.getApp().getUsername();
RequestParams params=new RequestParams();
params.addQueryStringParameter("params","{\"goodId\":\"" + goodId
+ "\",\"username\":\"" + username + "\",\"goodNum\":\"" + goodNum + "\"}");
httpUtils.send(HttpMethod.POST,NoChange.UPDATE_SHOPCAR_GOODNUM,params,new RequestCallBack<String>() {
public void onSuccess(ResponseInfo<String> responseInfo) {
System.out.println("_____更新购物车数量成功");
}
public void onFailure(HttpException error, String msg) {
System.out.println("____更新商品数量网络连接错误");
}
});
}
示例6: changAddressDefault
import com.lidroid.xutils.http.RequestParams; //导入方法依赖的package包/类
/**
* 向数据库发送数据改变默认地址
*
* @param oldIndex
* 改变前的默认地址的id
* @param newIndex
* 改变为默认地址的id
*/
public void changAddressDefault(int oldIndex, int newIndex) {
RequestParams params = new RequestParams();
params.addQueryStringParameter("params", "{\"oldIndex\":\"" + oldIndex
+ "\",\"newIndex\":\"" + newIndex + "\"}");
httpUtils.send(HttpMethod.POST, NoChange.CHANGE_DEFAULT_ADDRESS,
params, new RequestCallBack<String>() {
public void onSuccess(ResponseInfo<String> responseInfo) {
Gson gson = new Gson();
GetJsonModel jsonModel = gson.fromJson(
responseInfo.result, GetJsonModel.class);
if ("success".equals(jsonModel.getMsg())) {
Toast.makeText(context, "设置成功", 1).show();
} else {
Toast.makeText(context, "设置失败", 1).show();
}
}
public void onFailure(HttpException error, String msg) {
System.out.println("-----改变默认地址网络连接错误");
}
});
}
示例7: updateDefaultAddress
import com.lidroid.xutils.http.RequestParams; //导入方法依赖的package包/类
/**
* 更新服务器的默认地址信息
*
* @param id
* 需要更改的地址信息id
*/
private void updateDefaultAddress(AddressInfo info) {
RequestParams params = new RequestParams();
Gson gson = new Gson();
params.addQueryStringParameter("params", gson.toJson(info));
//System.out.println("----更新----"+ params.getQueryStringParams().toString());
http1.send(HttpMethod.POST, NoChange.UPDATE_ADDRESSINFO, params,
new RequestCallBack<String>() {
public void onSuccess(ResponseInfo<String> responseInfo) {
System.out.println("------更新地址成功");
}
public void onFailure(HttpException error, String msg) {
System.out.println("-----更新 地址信息网络错误----" + msg);
}
});
}
示例8: fillDeviceAndRomInfo
import com.lidroid.xutils.http.RequestParams; //导入方法依赖的package包/类
public static void fillDeviceAndRomInfo(@NonNull RequestParams requestParams) {
DeviceUtil d = DeviceUtil.getOSParameters(BaseApplication.mApplicationContext);
String serial = android.os.Build.SERIAL;
if (serial.equals(DeviceUtil.FACTORY_SERIAL)) {
serial = NetworkUtil.MacAddressUtil.getLocalMacAddressFromWifiInfo(BaseApplication.mApplicationContext); // mac地址
}
requestParams.addQueryStringParameter("__DeviceSerial__", serial);// 4f8456asd
requestParams.addQueryStringParameter("__DeviceModel__", android.os.Build.PRODUCT);// TCL M3G
requestParams.addQueryStringParameter("__OS__", "android " + d.getDeviceNameReleaseVersion());// andorid 5.1.1
requestParams.addQueryStringParameter("__RomName__", android.os.Build.DISPLAY);// sudamod 省略若干...
requestParams.addQueryStringParameter("__AppVersionCode__", "" + DeviceUtil.getAppVersionCode(BaseApplication.mApplicationContext));// 22
requestParams.addQueryStringParameter("__AppVersionName__", DeviceUtil.getAppVersionName(BaseApplication.mApplicationContext));// 0.5_r484
}
示例9: addUserInfo
import com.lidroid.xutils.http.RequestParams; //导入方法依赖的package包/类
public void addUserInfo() {
String md5pwd = MD5.toMD5(value_repet);
String url = MeTool.ADD;
RequestParams params = new RequestParams();
UserInfoModle modle = new UserInfoModle();
modle.setUsername(value_user);
modle.setPassword(md5pwd);
String value = new Gson().toJson(modle);
// params.addQueryStringParameter("params", "{\"name\":\"+va+"\"}");
params.addQueryStringParameter("params", value);
http.send(HttpMethod.POST, url, params, new RequestCallBack<String>() {
@Override
public void onSuccess(ResponseInfo<String> responseInfo) {
if (responseInfo.result.equals("0")) {
Toast.makeText(Me_Register.this, "注册成功!",
Toast.LENGTH_SHORT).show();
finish();
} else {
Toast.makeText(Me_Register.this, "用户名已存在!",
Toast.LENGTH_SHORT).show();
}
// new Gson().fromJson(responseInfo.result, **.class);
// **代表你要吧json数据转换成什么类型, modle,HasMap,List类型等等
}
@Override
public void onFailure(HttpException error, String msg) {
Toast.makeText(Me_Register.this, "注册失败!", Toast.LENGTH_SHORT)
.show();
}
});
}
示例10: setShopCar
import com.lidroid.xutils.http.RequestParams; //导入方法依赖的package包/类
public void setShopCar(String username){
httpUtils=new HttpUtils();
RequestParams params=new RequestParams();
params.addQueryStringParameter("params","{\"username\":\"" + username
+ "\"}");
httpUtils.send(HttpMethod.POST,NoChange.SELECT_SHOP_CAR,params,new RequestCallBack<String>() {
public void onSuccess(ResponseInfo<String> responseInfo) {
if("购物车无商品".equals(responseInfo.result)){
return ;
}else{
datas=gson.fromJson(responseInfo.result,new TypeToken<List<GoodInfo>>(){}.getType());
if(datas.size()>0){
System.out.println(adapter+"__________adaptersS");
if (adapter==null) {
adapter=new ShopCarAdapter(LaPinShopCar.this,datas);
}
adapter.setOnUpdateText(LaPinShopCar.this);
listView.setAdapter(adapter);
}
}
}
public void onFailure(HttpException error, String msg) {
System.out.println("___查询购物车网络链接失败");
}
});
}
示例11: setPortrait
import com.lidroid.xutils.http.RequestParams; //导入方法依赖的package包/类
@Override
public void setPortrait(final Handler handler, String userId, String portraitURL) {
Log.e(TAG, "setPortrait");
HttpUtils http = new HttpUtils();
http.configTimeout(Constants.REQUEST_TIME_OUT); //设置超时时间
RequestParams params = new RequestParams();
params.addQueryStringParameter("userId", userId);
params.addQueryStringParameter("portraitURL", portraitURL);
http.send(HttpRequest.HttpMethod.POST,
RcpUri.INTERFACE_URI_SET_PORTRAIT, params,
new RequestCallBack<String>() {
@SuppressWarnings("rawtypes")
@Override
public void onSuccess(ResponseInfo<String> responseInfo) {
String rs = responseInfo.result;
Map map = FastjsonUtil.json2Map(rs);
int code = Integer.parseInt(String.valueOf(map.get("code")));
if(code == Constants.SUCCESS) {
Log.e(TAG, "set portrait success");
handler.sendEmptyMessage(Constants.SUCCESS_1);
} else {
Log.e(TAG, "set portrait fail, fail msg is " + map.get("msg"));
handler.sendEmptyMessage(Constants.FAILURE_1);
ToastUtils.showMessage(mContext,
R.string.set_portrait_fail);
}
}
@Override
public void onFailure(HttpException error, String msg) {
Log.e(TAG, "set portrait error", error);
handler.sendEmptyMessage(Constants.FAILURE_1);
if(!HttpUtil.isNetworkAvailable(mContext)) {
ToastUtils.showMessage(mContext, R.string.no_net);
} else {
ToastUtils.showMessage(mContext,
R.string.set_portrait_fail);
}
}
});
}
示例12: checkUserExeist
import com.lidroid.xutils.http.RequestParams; //导入方法依赖的package包/类
@Override
public void checkUserExeist(String phone, final ApiCallBack apiCallBack) {
HttpUtils http = new HttpUtils();
http.configTimeout(Constants.REQUEST_TIME_OUT); //设置超时时间
http.configDefaultHttpCacheExpiry(0);
RequestParams params = new RequestParams();
params.addQueryStringParameter("phone", phone);
http.send(HttpRequest.HttpMethod.POST,
RcpUri.INTERFACE_URI_CHECK_EXEIST, params,
new RequestCallBack<String>() {
@SuppressWarnings("rawtypes")
@Override
public void onSuccess(ResponseInfo<String> responseInfo) {
String rs = responseInfo.result;
Map map = FastjsonUtil.json2Map(rs);
int code = Integer.parseInt(String.valueOf(map.get("code")));
if(code == Constants.SUCCESS) {
Log.e(TAG, "checkUserExeist success");
apiCallBack.onSuccess(code);
} else {
Log.e(TAG, "checkUserExeist fail, fail msg is " + map.get("msg"));
apiCallBack.onFailure(String.valueOf(code));
}
}
@Override
public void onFailure(HttpException error, String msg) {
Log.e(TAG, "checkUserExeist error", error);
if(!HttpUtil.isNetworkAvailable(mContext)) {
ToastUtils.showMessage(mContext, R.string.no_net);
} else {
apiCallBack.onError(error, msg);
}
}
});
}
示例13: reSetPassword
import com.lidroid.xutils.http.RequestParams; //导入方法依赖的package包/类
@Override
public void reSetPassword(String phone, String password,
final ApiCallBack apiCallBack) {
HttpUtils http = new HttpUtils();
http.configTimeout(Constants.REQUEST_TIME_OUT); //设置超时时间
http.configDefaultHttpCacheExpiry(0);
RequestParams params = new RequestParams();
params.addQueryStringParameter("phone", phone);
params.addQueryStringParameter("password", password);
http.send(HttpRequest.HttpMethod.POST,
RcpUri.INTERFACE_URI_RESET_PWD, params,
new RequestCallBack<String>() {
@SuppressWarnings("rawtypes")
@Override
public void onSuccess(ResponseInfo<String> responseInfo) {
String rs = responseInfo.result;
Map map = FastjsonUtil.json2Map(rs);
int code = Integer.parseInt(String.valueOf(map.get("code")));
if(code == Constants.SUCCESS) {
Log.e(TAG, "reSetPassword success");
User user = FastjsonUtil.deserialize(
map.get("data").toString(), User.class);
apiCallBack.onSuccess(user);
} else {
Log.e(TAG, "reSetPassword fail, fail msg is " + map.get("msg"));
apiCallBack.onFailure(String.valueOf(code));
}
}
@Override
public void onFailure(HttpException error, String msg) {
Log.e(TAG, "reSetPassword error", error);
if(!HttpUtil.isNetworkAvailable(mContext)) {
ToastUtils.showMessage(mContext, R.string.no_net);
} else {
apiCallBack.onError(error, msg);
}
}
});
}
示例14: getQuTu
import com.lidroid.xutils.http.RequestParams; //导入方法依赖的package包/类
@Override
public void getQuTu(final Handler handler, int newOrHotFlag, int offset,
int count) {
HttpUtils http = new HttpUtils();
http.configDefaultHttpCacheExpiry(1000 * 60 * 10); //缓存超期时间10分钟
http.configTimeout(Constants.REQUEST_TIME_OUT); //设置超时时间
RequestParams params = new RequestParams();
params.addQueryStringParameter("newOrHotFlag", String.valueOf(newOrHotFlag));
params.addQueryStringParameter("offset", String.valueOf(offset));
params.addQueryStringParameter("count", String.valueOf(count));
http.send(HttpRequest.HttpMethod.GET,
RcpUri.INTERFACE_URI_LIST, params,
new RequestCallBack<String>() {
@Override
public void onSuccess(ResponseInfo<String> responseInfo) {
String rs = responseInfo.result;
Map map = FastjsonUtil.json2Map(rs);
int code = Integer.parseInt(String.valueOf(map.get("code")));
if (code != 200) {
//请求失败
handler.sendEmptyMessage(Constants.FAILURE);
return;
}
PageResult page = FastjsonUtil.deserialize(
map.get("data").toString(), PageResult.class);
Message message = new Message();
Bundle bundle = new Bundle();
bundle.putSerializable("pageResult", page);
message.what = Constants.SUCCESS;
message.setData(bundle);
handler.sendMessage(message);
}
@Override
public void onFailure(HttpException error, String msg) {
handler.sendEmptyMessage(Constants.FAILURE);
}
});
}
示例15: refush
import com.lidroid.xutils.http.RequestParams; //导入方法依赖的package包/类
@Override
public void refush(final Handler handler, int newOrHotFlag, int count) {
HttpUtils http = new HttpUtils();
http.configDefaultHttpCacheExpiry(0); //缓存超期时间0分钟
http.configTimeout(Constants.REQUEST_TIME_OUT); //设置超时时间
RequestParams params = new RequestParams();
params.addQueryStringParameter("newOrHotFlag", String.valueOf(newOrHotFlag));
// params.addQueryStringParameter("offset", String.valueOf(1));
params.addQueryStringParameter("count", String.valueOf(count));
http.send(HttpRequest.HttpMethod.GET,
RcpUri.INTERFACE_URI_LIST, params,
new RequestCallBack<String>() {
@Override
public void onSuccess(ResponseInfo<String> responseInfo) {
String rs = responseInfo.result;
Map map = FastjsonUtil.json2Map(rs);
int code = Integer.parseInt(String.valueOf(map.get("code")));
if (code != 200) {
//请求失败
handler.sendEmptyMessage(Constants.FAILURE);
return;
}
PageResult page = FastjsonUtil.deserialize(
map.get("data").toString(), PageResult.class);
Message message = new Message();
Bundle bundle = new Bundle();
bundle.putSerializable("pageResult", page);
message.what = Constants.SUCCESS_1;
message.setData(bundle);
handler.sendMessage(message);
}
@Override
public void onFailure(HttpException error, String msg) {
handler.sendEmptyMessage(Constants.FAILURE);
}
});
}