1添加说明用startActivityForResult()获取输入框的内容就行了啊
2tabactivity...
3 public static String getHttpPost(String actionCode, Map<String, String> map)
throws AppException{
InputStream inputStream = null;
String str = "" ;
String uriAPI = URLs.PATH + actionCode;
// HttpPost httpRequest =new HttpPost(uriAPI);
List<NameValuePair> params = new ArrayList<NameValuePair>(); params.add(new BasicNameValuePair("Msisdn", AppContext.getMsisdn()));
// params.add(new BasicNameValuePair("ActionCode", actionCode));
for(Map.Entry<String, String> entry : map.entrySet()){
params.add(new BasicNameValuePair(entry.getKey(), entry.getValue()));
} try {
BasicHttpParams httpParameters = new BasicHttpParams();
HttpConnectionParams.setConnectionTimeout(httpParameters, URLs.TIME_OUT);// 超时时间25秒
HttpPost httpRequest = new HttpPost(uriAPI);
HttpClient httpClient = new DefaultHttpClient(httpParameters); httpRequest.setEntity(new UrlEncodedFormEntity(params, "gbk"));//web端格式是gbk HttpResponse httpResponse = httpClient.execute(httpRequest); int statusCode = httpResponse.getStatusLine().getStatusCode();
if (statusCode == HttpStatus.SC_OK) { str = EntityUtils.toString(httpResponse.getEntity()); } else {
// Log.v("tag", "error resp="+httpResponse); } } catch (IOException e) {
e.printStackTrace();
}
return str;
}
2tabactivity...
3 public static String getHttpPost(String actionCode, Map<String, String> map)
throws AppException{
InputStream inputStream = null;
String str = "" ;
String uriAPI = URLs.PATH + actionCode;
// HttpPost httpRequest =new HttpPost(uriAPI);
List<NameValuePair> params = new ArrayList<NameValuePair>(); params.add(new BasicNameValuePair("Msisdn", AppContext.getMsisdn()));
// params.add(new BasicNameValuePair("ActionCode", actionCode));
for(Map.Entry<String, String> entry : map.entrySet()){
params.add(new BasicNameValuePair(entry.getKey(), entry.getValue()));
} try {
BasicHttpParams httpParameters = new BasicHttpParams();
HttpConnectionParams.setConnectionTimeout(httpParameters, URLs.TIME_OUT);// 超时时间25秒
HttpPost httpRequest = new HttpPost(uriAPI);
HttpClient httpClient = new DefaultHttpClient(httpParameters); httpRequest.setEntity(new UrlEncodedFormEntity(params, "gbk"));//web端格式是gbk HttpResponse httpResponse = httpClient.execute(httpRequest); int statusCode = httpResponse.getStatusLine().getStatusCode();
if (statusCode == HttpStatus.SC_OK) { str = EntityUtils.toString(httpResponse.getEntity()); } else {
// Log.v("tag", "error resp="+httpResponse); } } catch (IOException e) {
e.printStackTrace();
}
return str;
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货