title: How to Bring Activity on Top from Service
body: <p>I have two activity 1)FrmHome which I have senTtoback 2)ScreenLock which I want to open from Service. When services calls the screen unlock the activity opens in background. When I tap on the application I can see the Screenlock Activity. I want ScreenLock Activity should come up on top without tapping on the app</p>
  
  <p>And here is the service
  and handler</p>
  
  <pre><code>public class FrmHome extends ActionBarActivity {
  
  BroadcastReceiver mybroadcast = new BroadcastReceiver() {
  
  //When Event is published, onReceive method is called
  @Override
  public void onReceive(Context context, Intent intent) {
      // TODO Auto-generated method stub
          Log.i("[BroadcastReceiver]", "MyReceiver");
  
          if(intent.getAction().equals(Intent.ACTION_USER_PRESENT)){
              Log.i("[BroadcastReceiver]", "Screen ON");
  
              Intent intent1 = new Intent(context, ScreenLock.class);
              intent1.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK|Intent.FLAG_ACTIVITY_SINGLE_TOP);
              startActivity(intent1);
  
  
  
          }
          else if(intent.getAction().equals(Intent.ACTION_SCREEN_OFF)){
              Log.i("[BroadcastReceiver]", "Screen OFF");
          }
  
    }
     };
    @Override
     protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
  
      getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
      setContentView(R.layout.activity_frm_home);
      // registerReceiver(mybroadcast, new IntentFilter(Intent.ACTION_SCREEN_ON));
       registerReceiver(mybroadcast, new IntentFilter(Intent.ACTION_USER_PRESENT));
  }
  } 
  </code></pre>
  
  <p>My new activity opens in background. When I click on the app I can see the new Screenlock Activity. But it is not coming to front automaticlly</p>