title: Load values every 5 minutes and pass to another method java android
body: <p>I want to check the data every 5 minutes and I want to pass this to another method but since it throws exception and has api version it's hard to pass the abc(mValue) to a callback</p>
  <pre><code>  String Value = &quot;&quot;;
      @RequiresApi(api = Build.VERSION_CODES.O)
      private void abc(String mValue) throws ParseException {
          Date date = new Date() ;
          SimpleDateFormat dateFormat = new SimpleDateFormat(&quot;mm&quot;) ;
          dateFormat.format(date);
          if(dateFormat.parse(dateFormat.format(date) + 5).after(dateFormat.parse(dateFormat.format(date)))) {
              Value = mValue;
              data(mValue);
              actualData(mValue);
          }else{
              someMethod();
          }
  
      }
  
  
  private void xyz(String mValue){
  Call&lt;somemethodname&gt; call1 = pass.user(xyz(mToken)) //I want to pass it like this but it is not possible so it would check the above condition 
  }
  
  </code></pre>
  <p>If there is any other way to check the time function, it would be helpful.</p>