I want to add a button on incoming call screen. I am using a transparent screen with button and i calling this activity during incoming call but its not working properly. the code i used is..
public class Recevo extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
        // TODO Auto-generated method stub
        TelephonyManager tm = (TelephonyManager)context.getSystemService(Service.TELEPHONY_SERVICE);
        Intent i= new Intent(context,Servo.class);
        int state = tm.getCallState();
      if(state==TelephonyManager.CALL_STATE_RINGING){
            String number=intent.getStringExtra("incoming_number");
            Log.i("State", "Call is Ringing");
            context.startService(i);
        }else if (state==TelephonyManager.CALL_STATE_IDLE) {
            Log.i("State", "Idle State");
            Toast.makeText(context, "Call is Idle", Toast.LENGTH_SHORT).show();
            context.stopService(i);
        } else if (state==TelephonyManager.CALL_STATE_OFFHOOK) {
            //Log.i("State", "Call is Ringing");
            //Toast.makeText(context, "Phone is Ringing", Toast.LENGTH_SHORT).show();
        }
public class Servo extends Service{
    @Override
    public IBinder onBind(Intent arg0) {
        // TODO Auto-generated method stub
        return null;
    }
    @Override
    public void onCreate() {
        // TODO Auto-generated method stub
        super.onCreate();
        //Toast.makeText(getApplicationContext(), "in servo", Toast.LENGTH_SHORT).show();
        Intent i = new Intent(Servo.this,Blank.class);
        startActivity(i);
    }
}
I have used a separate activity for showing this...
public class Blank extends Activity implements OnClickListener{
    Button b;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        setContentView(R.layout.blank);
        b=(Button)findViewById(R.id.button1);
        b.setOnClickListener(this);
    }
    @Override
    public void onClick(View v) {
        // TODO Auto-generated method stub
        Toast.makeText(getApplicationContext(), "Button Clicked", Toast.LENGTH_SHORT).show();
    }
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent" 
    android:background="@drawable/transparent">
    <Button
        android:id="@+id/button1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="147dp"
        android:text="Button" />
</RelativeLayout>
Logcat is...
04-09 13:45:00.837: E/AndroidRuntime(3478): FATAL EXCEPTION: main
04-09 13:45:00.837: E/AndroidRuntime(3478): java.lang.RuntimeException: Unable to create service com.example.transparentscreen.Servo: android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity  context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?
04-09 13:45:00.837: E/AndroidRuntime(3478):     at android.app.ActivityThread.handleCreateService(ActivityThread.java:1976)
04-09 13:45:00.837: E/AndroidRuntime(3478):     at android.app.ActivityThread.access$2500(ActivityThread.java:121)
04-09 13:45:00.837: E/AndroidRuntime(3478):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:997)
04-09 13:45:00.837: E/AndroidRuntime(3478):     at android.os.Handler.dispatchMessage(Handler.java:99)
04-09 13:45:00.837: E/AndroidRuntime(3478):     at android.os.Looper.loop(Looper.java:130)
04-09 13:45:00.837: E/AndroidRuntime(3478):     at android.app.ActivityThread.main(ActivityThread.java:3701)
04-09 13:45:00.837: E/AndroidRuntime(3478):     at java.lang.reflect.Method.invokeNative(Native Method)
04-09 13:45:00.837: E/AndroidRuntime(3478):     at java.lang.reflect.Method.invoke(Method.java:507)
04-09 13:45:00.837: E/AndroidRuntime(3478):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
04-09 13:45:00.837: E/AndroidRuntime(3478):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:624)
04-09 13:45:00.837: E/AndroidRuntime(3478):     at dalvik.system.NativeStart.main(Native Method)
04-09 13:45:00.837: E/AndroidRuntime(3478): Caused by: android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity  context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?
04-09 13:45:00.837: E/AndroidRuntime(3478):     at android.app.ContextImpl.startActivity(ContextImpl.java:652)
04-09 13:45:00.837: E/AndroidRuntime(3478):     at android.content.ContextWrapper.startActivity(ContextWrapper.java:258)
04-09 13:45:00.837: E/AndroidRuntime(3478):     at com.example.transparentscreen.Servo.onCreate(Servo.java:22)
04-09 13:45:00.837: E/AndroidRuntime(3478):     at android.app.ActivityThread.handleCreateService(ActivityThread.java:1966)
04-09 13:45:00.837: E/AndroidRuntime(3478):     ... 10 more
04-09 13:45:04.897: I/Process(3478): Sending signal. PID: 3478 SIG: 9
04-09 13:45:12.087: I/State(3582): Idle State
 
    