いろいろ試しましたが、アップロード時の通知に進行状況を表示できませんでした。非同期タスクを使用してデータをサーバーにアップロードできますが、Facebook で画像やビデオをアップロードするときのように、データをサーバーにアップロードして通知バーに表示する必要があります。
私はこれを行うことができません。非同期でデータをアップロードするための私のコードは以下のとおりです。
doInBackGround() メソッドで以下のコードを記述します。
HttpClient httpClient = new DefaultHttpClient();
HttpPost postRequest = new HttpPost(
"http://********.php?f=setAvatar");
ByteArrayBody bab = new ByteArrayBody(data, "receipt.jpg");
// File file= new File("/mnt/sdcard/forest.png");
// FileBody bin = new FileBody(file);
File file = new File(ProfileEdit.selectedImagePath);
MultipartEntity reqEntity = new MultipartEntity(
HttpMultipartMode.BROWSER_COMPATIBLE);
ContentBody cbFile = new FileBody(file, "image/jpeg");
reqEntity.addPart("im", cbFile);
reqEntity.addPart("u", new StringBody(USERID));
reqEntity.addPart("k", new StringBody(KEY));
reqEntity.addPart("p", new StringBody(pannelId));
//reqEntity.addPart("id", new StringBody(password));
//reqEntity.addPart("addExpenseResult", new StringBody(expenceresult));
postRequest.setEntity(reqEntity);
HttpResponse response = httpClient.execute(postRequest);
BufferedReader reader = new BufferedReader(new InputStreamReader(
response.getEntity().getContent(), "UTF-8"));
String sResponse;
StringBuilder s = new StringBuilder();