 |
|
Code (Android-Java)
@Override
protected synchronized Void doInBackground(String... params) {
ArrayList<NameValuePair> ar_data = new ArrayList<NameValuePair>();
ar_data.add(new BasicNameValuePair("post", "harr"));
try {
HttpClient http = new DefaultHttpClient();
HttpPost httppost = new HttpPost(params[0]);
httppost.setEntity(new UrlEncodedFormEntity(ar_data, "UTF-8"));
HttpResponse response = http.execute(httppost);
HttpEntity entity = response.getEntity();
InputStream in = entity.getContent();
BufferedReader reader = new BufferedReader(
new InputStreamReader(in));
String content = "";
String line = "";
while ((line = reader.readLine()) != null) {
content += line;
}
in.close();
reader.close();
} catch (ClientProtocolException e) {
Toast.makeText(getApplicationContext(),
"Caught ClientProtocolException", Toast.LENGTH_SHORT)
.show();
} catch (IOException e) {
Toast.makeText(getApplicationContext(), "Caught IOException",
Toast.LENGTH_SHORT).show();
} catch (Exception e) {
mProgressDialog.dismiss();
Toast.makeText(getApplicationContext(), "Error",
Toast.LENGTH_SHORT).show();
}
return null;
}
@Override
protected void onPostExecute(Void result) {
super.onPostExecute(result);
mProgressDialog.dismiss();
/*
* Intent intent = new Intent(SenderPage4.this, SenderPage5.class);
* startActivity(intent); finish();
*/
}
@Override
protected void onPreExecute() {
super.onPreExecute();
mProgressDialog = ProgressDialog.show(SenderPage4.this, "",
"Loading");
}
จังหวะการ Connect มันค้างอ่ะครับ ตัว AlertDialog ไม่ยอม dismiss เลย เราจะดักจับยังไงครับ ตอนที่มันค้างได้อ่ะครับ
Tag : Mobile, Android
|
|
 |
 |
 |
 |
Date :
2013-08-01 18:40:26 |
By :
ppstlineage |
View :
1048 |
Reply :
2 |
|
 |
 |
 |
 |
|
|
|
 |