title: Bring activity to front itself
body: <p>I want to bring the activty front when Timer ticked even if activity is paused.</p>
  
  <p>Thanks a lot..</p>
  
  <p>My code is below:</p>
  
  <pre><code>package cem.examples.wsAct;
  
  import something....
  
  public class main extends Activity {
  
  TextView tvResult, tvCount;
  Button btn;
  Timer timer;
  
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main);
  
  // setviews ....
  // (find on the layout and bind them to the fields)
  
      timer = new Timer();
      timer.scheduleAtFixedRate(new TimerTask() {
  
          @Override
          public void run() {
              runOnUiThread(new Runnable() {
  
                  @Override
                  public void run() {
           // bring activity to front
                      f_UpdateUI(); 
                  }
              });
          }
  
      }, 1000, 3000);
  }
  
  void f_UpdateUI() {
      String result = f_RetrieveFromWebService();
  
      // ??? Code... ???
      // If the activity is sended to back (how can I get it's state?)
      // Bring the activity even if it is paused or stopped (here is the lost part)
  }
  
  private String f_RetrieveFromWebService() {
  // connect to web service and return string
      return "ta ta taaaaa";
  }
  
  }
  </code></pre>