title: Start activity from service isn't working (Android)
body: <p>I created an overlay &quot;always on top button&quot;, which is a service <code>HUD</code>, and I can't start an activity <code>screen</code> from  there, it gives the error: <code>&quot;Unfortunately App has stopped&quot;</code>. In the beginning, all I used to know if there was any <code>TouchEvent</code>was a toast, and that toast was created, but it was created several times, so I don't know if it gives that error because this code, which is on <code>TouchEvent</code> body , is repeated several times too.
  here is my code:</p>
  <pre><code>public class HUD extends Service implements OnClickListener, OnTouchListener, OnLongClickListener {
  Button mButton;
  @Override
  public IBinder onBind(Intent intent) {
      return null;
  }
  
  @Override
  public void onCreate() {
      super.onCreate();
      //mView = new HUDView(this);
      
      
      mButton = new Button(this);
      mButton.setId(1);
      mButton.setText(&quot;Button&quot;);
      mButton.setClickable(true);
      mButton.setOnTouchListener(this);
      
      
      WindowManager.LayoutParams params = new WindowManager.LayoutParams(
              WindowManager.LayoutParams.WRAP_CONTENT,
                      WindowManager.LayoutParams.WRAP_CONTENT,
                      WindowManager.LayoutParams.TYPE_PHONE,
                      WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL |
                      WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE, 
                      PixelFormat.OPAQUE);
  
      params.gravity = Gravity.LEFT | Gravity.TOP;
      params.setTitle(&quot;Load Average&quot;);
      WindowManager wm = (WindowManager) getSystemService(WINDOW_SERVICE);
      wm.addView(mButton, params);
      
      
  }
  
  @Override
  public void onDestroy() {
      super.onDestroy();
      if(mButton != null)
      {
          ((WindowManager) getSystemService(WINDOW_SERVICE)).removeView(mButton);
          mButton = null;
      }
  }
  
  @Override
  public boolean onTouch(View v, MotionEvent event) {
      if(event.getX()&lt;mButton.getWidth() &amp; event.getY()&gt;0)
      {
      Toast.makeText(this,&quot;Overlay button event&quot;, Toast.LENGTH_SHORT).show(); //this my toast
      Intent i = new Intent();                                                //this is my new acivity (intent)
      i.setClass(HUD.this, screen.class);
      i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
      startActivity(i);
      HUD.this.stopSelf();
      }
      return false;
  }
  
  
  @Override
  public void onClick(DialogInterface dialog, int which) {
      // TODO Auto-generated method stub
      Toast.makeText(this,&quot;Click&quot;, Toast.LENGTH_SHORT).show();
  }
  
  @Override
  public boolean onLongClick(View v) {
      // TODO Auto-generated method stub
      System.exit(1);
      return false;
  }
  
  }
  </code></pre>
  <p>So my question is, is this code on <code>TouchEvent</code> body being repeated several times? If it is, is that the cause of the error?</p>
  <p>log cat:</p>
  <pre><code>07-20 22:11:06.962: I/Choreographer(1620): Skipped 52 frames!  The application may be doing too much work on      its main thread.
  07-20 22:11:08.062: D/AndroidRuntime(1620): Shutting down VM
  07-20 22:11:08.062: W/dalvikvm(1620): threadid=1: thread exiting with uncaught exception (group=0x40a71930)
  07-20 22:11:08.132: E/AndroidRuntime(1620): FATAL EXCEPTION: main
  07-20 22:11:08.132: E/AndroidRuntime(1620): android.app.SuperNotCalledException: Activity    {com.example.screenshot/com.example.screenshot.screen} did not call through to super.onCreate()
  07-20 22:11:08.132: E/AndroidRuntime(1620):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2146)
  07-20 22:11:08.132: E/AndroidRuntime(1620):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
  07-20 22:11:08.132: E/AndroidRuntime(1620):     at android.app.ActivityThread.access$600(ActivityThread.java:141)
  07-20 22:11:08.132: E/AndroidRuntime(1620):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
  07-20 22:11:08.132: E/AndroidRuntime(1620):     at android.os.Handler.dispatchMessage(Handler.java:99)
  07-20 22:11:08.132: E/AndroidRuntime(1620):     at android.os.Looper.loop(Looper.java:137)
  07-20 22:11:08.132: E/AndroidRuntime(1620):     at android.app.ActivityThread.main(ActivityThread.java:5041)
  07-20 22:11:08.132: E/AndroidRuntime(1620):     at java.lang.reflect.Method.invokeNative(Native Method)
  07-20 22:11:08.132: E/AndroidRuntime(1620):     at java.lang.reflect.Method.invoke(Method.java:511)
  07-20 22:11:08.132: E/AndroidRuntime(1620):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
  07-20 22:11:08.132: E/AndroidRuntime(1620):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
  07-20 22:11:08.132: E/AndroidRuntime(1620):     at dalvik.system.NativeStart.main(Native Method)
  </code></pre>
  <p>screen.java:</p>
  <pre><code>public class screen extends Activity {
  
  @Override
  public void onCreate(Bundle savedInstanceState) {
  Toast.makeText(getApplicationContext(), &quot;Made it&quot;, 0).show();
  finish();
  }
  }
  </code></pre>