編輯:關於Android編程
public static String getDataByPost(String APIUrl,Map<String, String> paramsHashMap){
String result=null;
try {
HttpPost httpPost = new HttpPost(APIUrl);
DefaultHttpClient httpClient = getHttpClient();
List<BasicNameValuePair> postData = new ArrayList<BasicNameValuePair>();
for (Map.Entry<String, String> entry : paramsHashMap.entrySet()) {
postData.add(new BasicNameValuePair(entry.getKey(), entry.getValue()));
}
UrlEncodedFormEntity entity = new UrlEncodedFormEntity(postData,HTTP.UTF_8);
httpPost.setEntity(entity);
HttpEntity httpEntity = null;
HttpResponse response = null;
response = httpClient.execute(httpPost);
httpEntity = response.getEntity();
InputStream is = httpEntity.getContent();
StringBuffer sb = new StringBuffer();
BufferedReader br = new BufferedReader(new InputStreamReader(is));
String line = "";
while ((line = br.readLine()) != null) {
sb.append(line);
}
result=sb.toString();
// try {
// String path=Environment.getExternalStorageDirectory()+File.separator+"xxxlog.txt";
// File file=new File(path);
// file.createNewFile();
// FileWriter fileWriter=new FileWriter(file);
// fileWriter.write(sb.toString());
// fileWriter.close();
// } catch (Exception e) {
// }
System.out.println(APIUrl+"--->"+result);
} catch (Exception e) {
}
return result;
}
Android TV開發
前言這裡主要記錄幾個TV問題的解決方案,如果對這個不感興趣的其實就不用往下看了。這幾天有一個需求就是要求出一個TV版本的app,之前沒有具體的了解Tv版的app有手機端的
自定義ImageView實現局部截圖功能
1、前言最近在做一個能夠自選區域進行局部截圖的功能,接下來,會給大家講解,整個截圖的實現過程。筆者這邊實現的自選區域的形狀是矩形,讀者如果有需要,可以根據我給大家講解的思
android自定義view 模仿win10進度條
先上預覽圖:流程1.一個勻速圓周運動的點 2.多個勻速圓周運動的點 3.多個圓周運動的點,速度由快到慢 4.點與點之間的間距線性減少,動畫的最後合為一個點 5.為了讓動畫
安卓微信閃退怎麼辦 微信閃退怎麼辦 微信打不開怎麼辦
說起APP應用閃退很多用戶會第一時間想到蘋果設備閃退問題,而出現閃退並非蘋果的"專利",而在安卓蘋果下,近期就有用戶遇到微信手機版出現閃