I have tried a lot but have been unsuccessful in displaying progress in notification at uploading. I am able to upload data to server using Asynch Task but now I need to upload the data to server and display in notification bar, like when we upload image or video in Facebook.
I am unable to do this. My code for uploading data through asynch are below.
I write below code in doInBackGround() method:
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();