title: How show progressbar in notification for all android platforms using remoteviews
body: <p>I want to show <code>progressbar</code> in notification for all android platforms.I use remote view for showing <code>progress bar</code> in android. I already add <strong>android-support-v4</strong> library in my project.If I replace</p>
  
  <pre><code> mBuilder = new NotificationCompat.Builder(MainActivity.this);
   notification = mBuilder.build();
  </code></pre>
  
  <p><strong>to</strong></p>
  
  <pre><code> notification = new Notification(R.drawable.notification, "simulating a upload", System            .currentTimeMillis());
  </code></pre>
  
  <p>then notification is showing, but it is deprecated method.</p>
  
  <p><strong>Here is code:</strong></p>
  
  <pre><code> class SendDatabaseToServer extends
          AsyncTask&lt;ArrayList&lt;LogFishMetadata&gt;, Integer, String&gt; {
      private NotificationCompat.Builder mBuilder;
      private NotificationManager mNotifyManager;
      private RemoteViews remoteViews;
      private Intent intent;
      private PendingIntent pendingIntent;
      private Notification notification;
      private int notificationId = 1;
  
      int start;
      int percentage;
      int  inc;
      public SendDatabaseToServer(int value) {
          // TODO Auto-generated constructor stub
          logout = value;
      }
  
      @Override
      protected void onPreExecute() {
          // TODO Auto-generated method stub
          super.onPreExecute();
  
          mNotifyManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
          intent = new Intent(MainActivity.this, MainActivity.class);
          pendingIntent = PendingIntent.getActivity(MainActivity.this,
                  notificationId, intent, 0);
          remoteViews = new RemoteViews(getPackageName(),
                  R.layout.notification_downloader);
          mBuilder = new NotificationCompat.Builder(MainActivity.this);
          notification = mBuilder.build();
    //notification = new Notification(R.drawable.notification, "simulating a upload", System.currentTimeMillis());
          notification.contentIntent = pendingIntent;
          notification.flags = notification.flags
                  | Notification.FLAG_ONGOING_EVENT;
          notification.contentView = remoteViews;
           notification.contentView.setTextViewText(R.id.timeStamp, DateTime.getStringFromDate(new Date()));
           notification.contentView.setTextViewText(R.id.progress,
                      "UPloading....");
          notification.contentView.setProgressBar(R.id.progressBar, 100, 0,
                  false);
          mNotifyManager.notify(notificationId, notification);
      }
  
      @Override
      protected String doInBackground(ArrayList&lt;LogFishMetadata&gt;... params) {
          // TODO Auto-generated method stub
          int count = params[0].size();
           percentage=100/count;
  
          for (int i = 0; i &lt; params[0].size(); i++) {
              System.out.println("........." + i);
              start=i*percentage;
              inc=i+1;
              try {
                  database.updateServerdata(params[0].get(i));
  
                          for(int j=start;j&lt;=inc*percentage;j++)
                          {
                          publishProgress(j);
                          }                           
  
              } catch (Exception e) {
                  // TODO: handle exception
  
              }
          }
  
          return null;
      }
  
      @Override
      protected void onProgressUpdate(Integer... values) {
          // TODO Auto-generated method stub
          super.onProgressUpdate(values);
          // progressBar.setProgress(values[0]);
          System.out.println("values......." + values[0]);
          if(values[0]&gt;=100)
          {
              values[0]=98;
          }
          notification.contentView.setProgressBar(R.id.progressBar, 100,
                  values[0], false);
          mNotifyManager.notify(notificationId, notification);
  
  
      }
  
      @Override
      protected void onPostExecute(String result) {
          // TODO Auto-generated method stub
          super.onPostExecute(result);
          notification.contentView.setTextViewText(R.id.progress,
                  "UPloading Complete");
          notification.contentView.setProgressBar(R.id.progressBar,100, 100,
                  false);
          mNotifyManager.notify(notificationId, notification);
          if (logout == 2) {
  
              System.out.println(" send Aler     dialog....................................");
              logoutConfirmationDialog("Sync Complete; Do you still want to logout?");
  
          }
          System.out.println("complete");
      }
  
  }
  </code></pre>