title: Start timer after button click
body: <p>I want to start timer after clicking on Button and poll for every 3 secs.</p>
  
  <p>I am using following code.</p>
  
  <pre><code>private EditText url;
  private Button submit;
  private TextView error;
  String some_URL;
  
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_live);
  
      loadviews();
   handler=new Handler();
   submit.setOnClickListener(new OnClickListener() {
  
          @Override
          public void onClick(View v) {
          some_URL="http://"+url.getText().toString();
                getStatus();
          }
  
      }
  });
  private void getStatus() {
      // TODO Auto-generated method stub
  
      handler.postDelayed(new Runnable(){
  
          @Override
          public void run() {
              // TODO Auto-generated method stub
              new Class_Poll().execute(some_URL);
                   error.setText("ID:"+ID+"\n"+
                      "Name:"+name+"\n" +
                      "Type:"+type+"\n"+
                      "Status:"+Status+"\n"+
                      "Content:"+Content);
          }
      }, 3000);
  }
  }
  
  private void loadviews() {
      // TODO Auto-generated method stub
      url=(EditText)findViewById(R.id.url);
  
      submit=(Button)findViewById(R.id.Submit);
      error=(TextView)findViewById(R.id.log);
      error.setMovementMethod(new ScrollingMovementMethod());
  
  }
  
  
  private class Class_Poll extends AsyncTask&lt;String, Void, Void&gt;{
  
       private final HttpClient Client = new DefaultHttpClient();
  
       @Override
       protected Void doInBackground(String... arg0) {
           // TODO Auto-generated method stub
           Content=executeHttpRequest(some_URL);
           return null;
      }
  
       @Override
       protected void onPostExecute(Void unused) {
  
           JSONObject jsonResponse;
           try {
               jsonResponse = new JSONObject(Content);
  
               ID=jsonResponse.optString("ID").toString();
               name=jsonResponse.optString("Name").toString();
               type=jsonResponse.optString("Type").toString();
               Status=jsonResponse.optString("Status").toString();
  
               error.setText("ID:"+ID+"\n"+
                          "Name:"+name+"\n" +
                          "Type:"+type+"\n"+
                          "Status:"+Status+"\n"+
                          "Content:"+Content);
  
           } catch (JSONException e) {
  
               error.setText(e.toString());
           }
  
           //Toast.makeText(getApplicationContext(), "ID:"+ID+" Name:"+name+" Type:"+type+" Status:"+Status, Toast.LENGTH_LONG).show();
       }
   }
  
   public static String executeHttpRequest(String url)
   {
       HttpURLConnection urlConnection = null;
       try
       {
  
           URL httpUrl = new URL(url);
           urlConnection = (HttpURLConnection) httpUrl.openConnection();
           urlConnection.setRequestMethod("GET");
           urlConnection.addRequestProperty("Accept", "text/html,text/xhtml,application/xhtml+xml,application/xml;");
           urlConnection.setConnectTimeout(10000);
           InputStream in = null;
  
           try
           {
               in = urlConnection.getInputStream();
  
           } catch (NullPointerException e)
           {
               Log.e("Check", "Request Failed, Check the url");
               return null;
           }
  
           if (in != null)
           {
               in = new BufferedInputStream(in);
               String response  = readStream(in);
               Log.e("Check", response + "");
  
               if (response != null &amp;&amp; !response.isEmpty())
               {
                   // statusTrace.print(TAG, "Operation executed : " +
                   // isSuccess(response));
                   return response;
               } 
               else
               {
                   Log.e("Check", "Request Failed");
               }
           } else
               ;//statusTrace.print(TAG, "Request Failed");
  
       } catch (IOException e)
       {
           Log.e("Check", "Error : " + e.toString());
           //statusTrace.print("Error", "Network Error. Check connection and Tuxedo IP");
       }
  
       return null;
   }
  
       public static String readStream(InputStream in)throws IOException {
       // TODO Auto-generated method stub
       InputStreamReader is = new InputStreamReader(in);
       StringBuilder sb = new StringBuilder();
       BufferedReader br = new BufferedReader(is);
       String read = br.readLine();
  
       while (read != null)
       {
           sb.append(read);
           read = br.readLine();
       }  
       return sb.toString();
   }
  </code></pre>
  
  <p><code>error</code> is <code>TextView</code> in which I am displaying some Text. </p>
  
  <p>And I am invoking web service in Asyntask. So it is not executing asynchtask for delay of 3 seconds after button click.</p>
  
  <p>I don't know where know what is the problem exactly. It should execute actually, my textview is not getting updated for each 3 seconds. </p>