Androidでサービスが実行されているときにウィンドウをポップアップする方法を教えてください。つまり、Androidフォンで着信が検出されたときにウィンドウをポップアップするアプリを開発しています。私はたくさん検索しましたが、正確な説明は見つかりませんでした。どうすればこれを行うことができるか教えてください。
そして、私はこのコードを使用しています。このアプリを実行すると強制終了します。
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.telephony.PhoneStateListener;
import android.telephony.TelephonyManager;
import android.os.Bundle;
public class CallHelper extends Activity
{
    /**
     * Listener to detect incoming calls. 
     */
    public class CallStateListener extends PhoneStateListener
    {
        @Override
        public void onCallStateChanged(int state, String incomingNumber) 
        {
            switch (state) {
            case TelephonyManager.CALL_STATE_RINGING:
                // called when someone is ringing to this phone
                    Intent i = new Intent(getApplicationContext(), Out.class);
                    i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);   //must be provided
                    getApplicationContext().startActivity(i);
                break;
            }
        }
    }
    /**
     * Broadcast receiver to detect the outgoing calls.
     */
    private Context ctx;
    private TelephonyManager tm;
    private CallStateListener callStateListener;
    public CallHelper(Context ctx) 
    {
        this.ctx = ctx;     
        callStateListener = new CallStateListener();
    }
    /**
     * Start calls detection.
     */
    public void start() 
    {
        tm = (TelephonyManager) ctx.getSystemService(Context.TELEPHONY_SERVICE);
        tm.listen(callStateListener, PhoneStateListener.LISTEN_CALL_STATE);
    }
    /**
     * Stop calls detection.
     */
    public void stop() 
    {
        tm.listen(callStateListener, PhoneStateListener.LISTEN_NONE);
    }
       //Intent intent = new Intent(); 
       //startService(intent);
}
前もって感謝します!!!!!