title: How to run an async task for every x mins in android?
body: <p>how to run the async task at specific time? (I want to run it every 2 mins)</p>
  
  <p>I tried using  post delayed but it's not working?</p>
  
  <pre><code>    tvData.postDelayed(new Runnable(){
  
      @Override
      public void run() {
          readWebpage();
  
      }}, 100);
  </code></pre>
  
  <p>In the above code readwebpage is function which calls the async task for me..</p>
  
  <p>Right now below is the method which I am using</p>
  
  <pre><code>   public void onCreate(Bundle savedInstanceState) {
  
           readwebapage();
  
     }
  
     public void readWebpage() {
      DownloadWebPageTask task = new DownloadWebPageTask();
      task.execute("http://www.google.com");
  
     }
  
     private class DownloadWebPageTask extends AsyncTask&lt;String, Void, String&gt; {
      @Override
      protected String doInBackground(String... urls) {
          String response1 = "";
          response1=read(); 
                     //read is my another function which does the real work    
          response1=read(); 
          super.onPostExecute(response1);
          return response1;
      }
  
  
        protected void onPostExecute(String result) {
  
  
           try {
                  Thread.sleep(100);
              } catch (InterruptedException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
              }
  
              TextView tvData = (TextView) findViewById(R.id.TextView01);
              tvData.setText(result);
  
          DownloadWebPageTask task = new DownloadWebPageTask();
          task.execute(new String[] { "http://www.google.com" });
  
      }
  
      }
  </code></pre>
  
  <p>This is what I  my code is and it works perfectly fine but the big problem I drains my battery?</p>