Show progress while loading image to server, using MultipartEntity
<p>I sending image to server using this code:</p>

<pre><code>public void loadImage(final File image) {
    new Thread(new Runnable() {
        public void run() {
            try{
                MultipartEntity entity=new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE);
                entity.addPart("image", new FileBody(image));
                HttpResponse response=sendMultipart("http://myurl.net", entity);
            }catch(Exception e){
            }
        }
    }).start();
}

public HttpResponse sendMultipart(final String URL,MultipartEntity entity) throws IOException{
    HttpPost httpPost=new HttpPost(URL);
    httpPost.setEntity(entity);
    return sendRequest(httpPost);
}

public HttpResponse sendRequest(final HttpRequestBase mhttp) throws IOException{
    HttpParams params=new BasicHttpParams();
    HttpConnectionParams.setConnectionTimeout(params, REST.CONNECTION_TIMEOUT);
    HttpConnectionParams.setSoTimeout(params, REST.SERVER_TIMEOUT);
    HttpClient httpClient=new DefaultHttpClient(params);
    HttpResponse response=httpClient.execute(mhttp);

    //if we're been redirected then try to get relocated page
    if(response.getStatusLine().getStatusCode()!=HttpStatus.SC_OK){
        Header [] headers=response.getHeaders("Location");
        if(headers!=null &amp;&amp; headers.length!=0){
            String newUrl=headers[headers.length-1].getValue();
            HttpGet httpGet=new HttpGet(newUrl);
            response=httpClient.execute(httpGet);
        }
    }


    return response;
}
</code></pre>

<p>Question is: how to get loading progress?</p>

<p>Please note, that question is NOT "how to show progress", "how to load image". I've decided that it's better to use AsyncTask, but I still don't know how to get progress.</p>
