Hello i am creating an social app like whats app... i want to show circle progress bar on every image or video while uploading and downloading same as whats app. Anyone please help me how i can do this using custom adapter. Here is my code
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<RelativeLayout
    android:id="@+id/main_layout"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    >
  <RelativeLayout 
      android:id="@+id/imageView_layout"
       android:layout_width="150dp"
        android:layout_height="150dp">
       <ImageView
        android:id="@+id/displayimg"
        android:layout_width="150dp"
        android:layout_height="150dp"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:scaleType="fitXY"
        android:src="@drawable/ic_launcher" />
  </RelativeLayout>
<RelativeLayout
    android:id="@+id/progressbar_layout"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:layout_alignRight="@+id/imageView_layout"
    android:layout_marginRight="49dp"
    android:layout_marginTop="50dp"
    android:visibility="gone">
     <ProgressBar
    android:id="@+id/progressBar1"
    style="?android:attr/progressBarStyleHorizontal"
    android:layout_width="60dp"
    android:layout_height="60dp"
    android:progressDrawable="@drawable/circular_progress_bar"
   />
     <ImageView
         android:id="@+id/cancel_downloadimg"
         android:layout_width="40dp"
         android:layout_height="40dp"
         android:layout_centerHorizontal="true"
         android:layout_centerVertical="true"
         android:src="@drawable/dialog_ic_close_normal_holo_light" />
</RelativeLayout>
Above is my custom layout of adapter class
/**
     * Uploading the file to server
     * */
    private class UploadFileToServer extends AsyncTask<Void, Integer, String> {
        @Override
        protected void onPreExecute() {
            // setting progress bar to zero
            Chat_adapter.ViewHolder.progressBar.setProgress(0);
             mNotifyManager = (NotificationManager)mContext. getSystemService(Context.NOTIFICATION_SERVICE);
                mBuilder = new NotificationCompat.Builder(mContext);
            super.onPreExecute();
        }
        @Override
        protected void onProgressUpdate(Integer... progress) {
            // Making progress bar visible
        progressBar.setVisibility(View.VISIBLE);
            .progressBar.setProgress(progress[0]);
            // updating percentage value
            //txtPercentage.setText(String.valueOf(progress[0]) + "%");
        }
        @Override
        protected String doInBackground(Void... params)
        {
            return uploadFile();
        }
        @SuppressWarnings("deprecation")
        private String uploadFile() {
            String responseString = null;
            HttpClient httpclient = new DefaultHttpClient();
            HttpPost httppost = new HttpPost(serviceurl+"conversations.php");
            try {
                MultipartEntityBuilder entity = MultipartEntityBuilder.create();        
                mBuilder.setContentTitle("Zaplink")
                .setContentText("Uploading in progress")
                .setSmallIcon(R.drawable.ic_launcher);
                /* example for setting a HttpMultipartMode */
                entity.setMode(HttpMultipartMode.BROWSER_COMPATIBLE);
                File sourceFile = new File(imgDecodableString);
                // Progress listener - updates task's progress
                MyHttpEntity.ProgressListener progressListener =
                        new MyHttpEntity.ProgressListener() {
                            @Override
                            public void transferred(float progress) {
                               publishProgress((int) progress);
                               mBuilder.setProgress(100, (int) progress, false);
                            mNotifyManager.notify(1, mBuilder.build());
                            }
                        };
                // Adding file data to http body
                entity.addPart("file", new FileBody(sourceFile));
                // Extra parameters if you want to pass to server
                        entity.addTextBody("from_user",(prefid.getString("userid", null)),ContentType.TEXT_PLAIN);
                entity.addTextBody("to_user",touser_id,ContentType.TEXT_PLAIN);
                entity.addTextBody("message_type", type,ContentType.TEXT_PLAIN);    
                httppost.setEntity(new MyHttpEntity(entity.build(),
                        progressListener));
                // Making server call
                HttpResponse response = httpclient.execute(httppost);
                HttpEntity r_entity = response.getEntity();
                int statusCode = response.getStatusLine().getStatusCode();
                if (statusCode == 200) {
                    // Server response
                    responseString = EntityUtils.toString(r_entity);
                } else {
                    responseString = "Error occurred! Http Status Code: "
                            + statusCode;
                }
            } catch (ClientProtocolException e) {
                responseString = e.toString();
            } catch (IOException e) {
                responseString = e.toString();
            }
            return responseString;
        }
        @Override
        protected void onPostExecute(String result) {
            super.onPostExecute(result);
            progressBar.setVisibility(View.GONE);
            mBuilder.setContentText("Upload Successful");
            // Removes the progress bar
            mBuilder.setProgress(0, 0, false);
            mNotifyManager.notify(1, mBuilder.build());
        }
    }
Above is my code for uploading image and video Thanks in advance
