title: android get previous date of a corresponding date(not yesterday's date)
body: <p><strong><em>Please read question carefully before marking duplicate.</em></strong></p>
  
  <p>I want previous date of a <strong><em>corresponding</em></strong> date.<strong><em>(Not yesterday's date)</em></strong></p>
  
  <p>e.g. If user click button once he will be navigated to another screen and is shown data regarding yesterday.</p>
  
  <p>And if he clicks again the same button on that screen, then data should be shown on day before yesterday....and so on... till data present in my database.</p>
  
  <p>So I want to get previous date of a corresponding date. i.e. if I have date 31 Jan 2014(I'm using format 31012014 to store in db) then i should get date 30012014.</p>
  
  <p>I know how to get yesterday's date e.g. below code </p>
  
  <pre><code>    Calendar calendar = Calendar.getInstance();
      calendar.add(Calendar.DATE, -1);
      DateFormat dateFormat = new SimpleDateFormat("ddMMyyyy", Locale.getDefault());
      String yesterdayAsString = dateFormat.format(calendar.getTime());
  </code></pre>
  
  <p>which gives dates compared to today but I want previous date compared to some other valid date.</p>
  
  <p>So how to get that.</p>