本文整理汇总了Java中com.lidroid.xutils.http.client.multipart.MultipartEntity.addPart方法的典型用法代码示例。如果您正苦于以下问题:Java MultipartEntity.addPart方法的具体用法?Java MultipartEntity.addPart怎么用?Java MultipartEntity.addPart使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.lidroid.xutils.http.client.multipart.MultipartEntity
的用法示例。
在下文中一共展示了MultipartEntity.addPart方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: SignUp
import com.lidroid.xutils.http.client.multipart.MultipartEntity; //导入方法依赖的package包/类
/**注册方法。
* @param phoNum
* @param pwd
* @param SMSCode 短信验证码
* @param call 注册回调接口,字符串包含error证明错误
*/
public static void SignUp(String phoNum,String pwd,String SMSCode,CallString call){
String url = APIUtils.SignUpUrl;
MultipartEntity reqEntity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE);
try {
reqEntity.addPart("password", new StringBody(pwd));
reqEntity.addPart("device_id", new StringBody("864690025974851"));
reqEntity.addPart("client_id", new StringBody("1089857302"));
reqEntity.addPart("phone", new StringBody(phoNum));
reqEntity.addPart("client_secret",new StringBody("38e8c5aet76d5c012e32"));
reqEntity.addPart("verify_code",new StringBody(SMSCode));
reqEntity.addPart("grant_type",new StringBody("phone"));
} catch (Exception e) {
e.printStackTrace();
}
POST2meiPai(reqEntity,url,call);
}
示例2: Login
import com.lidroid.xutils.http.client.multipart.MultipartEntity; //导入方法依赖的package包/类
/**登录方法 返回结果调用JsonPaser解析
* @param phoNum
* @param pwd
* @param call 登录信息回调接口 登录成功返回包含access_token和一个User对象的JSON
*/
public static void Login(String phoNum,String pwd,CallString call){
String url = APIUtils.LoginUrl;
MultipartEntity reqEntity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE);
try {
reqEntity.addPart("password", new StringBody(pwd));
reqEntity.addPart("device_id", new StringBody("864690025974851"));
reqEntity.addPart("client_id", new StringBody("1089857302"));
reqEntity.addPart("phone", new StringBody(phoNum));
reqEntity.addPart("client_secret",new StringBody("38e8c5aet76d5c012e32"));
reqEntity.addPart("grant_type",new StringBody("phone"));
reqEntity.addPart("device_token",new StringBody("5198a1385aa95a5a77660e889df26f11"));
} catch (Exception e) {
e.printStackTrace();
}
POST2meiPai(reqEntity,url,call);
}
示例3: upload
import com.lidroid.xutils.http.client.multipart.MultipartEntity; //导入方法依赖的package包/类
public void upload(final Context ctx, final String url, final String localPath, final PostCallbackIA postCBIA) {
//HttpUtils http = new HttpUtils(60 * 1000);
RequestParams params = new RequestParams();
MultipartEntity entity = new MultipartEntity();
entity.addPart("file", new FileBody(new File(localPath)));
params.setBodyEntity(entity);
getSingleInstance().send(HttpRequest.HttpMethod.POST,
url,
params,
new RequestCallBack<String>() {
@Override
public void onStart() {
//testTextView.setText("conn...");
}
@Override
public void onLoading(long total, long current, boolean isUploading) {
/*if (isUploading) {
testTextView.setText("upload: " + current + "/" + total);
} else {
testTextView.setText("reply: " + current + "/" + total);
}*/
}
@Override
public void onSuccess(ResponseInfo<String> responseInfo) {
postCBIA.onSuccess(responseInfo);
}
@Override
public void onFailure(HttpException error, String msg) {
postCBIA.onFailure(error, msg);
}
});
}
示例4: getVerifySMS
import com.lidroid.xutils.http.client.multipart.MultipartEntity; //导入方法依赖的package包/类
/**
* 获取短信验证码,已经在子线程中。n秒后重新发送验证码请重新调用我
*
* @param phoNum 电话号码
* @param pwd 密码
* @param call 返回信息的回调结果。
* 一切顺利返回的json中包含一个true
*/
public static void getVerifySMS(final String phoNum, final String pwd, final CallString call) {
String url = APIUtils.getSMSUrl;
MultipartEntity reqEntity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE);
try {
reqEntity.addPart("password", new StringBody(pwd));
reqEntity.addPart("device_id", new StringBody("864690025974851"));
reqEntity.addPart("client_id", new StringBody("1089857302"));
reqEntity.addPart("phone", new StringBody(phoNum));
} catch (Exception e) {
e.printStackTrace();
}
POST2meiPai(reqEntity, url, call);
}
示例5: FriendShipCreate
import com.lidroid.xutils.http.client.multipart.MultipartEntity; //导入方法依赖的package包/类
/** 通过ID关注用户
* @param access_token
* @param id
* @param call 成功返回"following": true,"followed_by": false
* 错误返回"error_code": 20506, "error": "已经关注过TA了"
*/
public static void FriendShipCreate(String access_token,String id,CallString call){
String url = APIUtils.getFriendShipCreate();
MultipartEntity reqEntity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE);
try {
reqEntity.addPart("access_token", new StringBody(access_token));
reqEntity.addPart("id", new StringBody(id));
} catch (Exception e) {
e.printStackTrace();
}
POST2meiPai(reqEntity,url,call);
}
示例6: FriendShipCancle
import com.lidroid.xutils.http.client.multipart.MultipartEntity; //导入方法依赖的package包/类
/** 通过ID取消关注
* @param access_token
* @param id
* @param call 成功返回 "following": false,"followed_by": false
* 失败返回"error_code": 20508,"error": "你还未关注此用户"
*/
public static void FriendShipCancle(String access_token,String id,CallString call){
String url = APIUtils.getFriendShipCancle();
MultipartEntity reqEntity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE);
try {
reqEntity.addPart("access_token", new StringBody(access_token));
reqEntity.addPart("id", new StringBody(id));
} catch (Exception e) {
e.printStackTrace();
}
POST2meiPai(reqEntity,url,call);
}
示例7: CommentCreate
import com.lidroid.xutils.http.client.multipart.MultipartEntity; //导入方法依赖的package包/类
/**发送评论方法
* @param access_token
* @param MediaId 要评论视频的ID
* @param comment 评论内容
* @param call 成功 返回一个单个的CommentBean的json,即刚刚发送的评论
* 错误 "error_code": 10107,"error": "系统错误",
*/
public static void CommentCreate(String access_token,String MediaId,String comment,CallString call){
String url = APIUtils.getCommentCreatLink();
MultipartEntity reqEntity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE);
try {
reqEntity.addPart("access_token", new StringBody(access_token));
reqEntity.addPart("id", new StringBody(MediaId));
reqEntity.addPart("comment",new StringBody(comment));
} catch (Exception e) {
e.printStackTrace();
}
POST2meiPai(reqEntity,url,call);
}