1

I want to make like this (red area)

enter image description here

Now I do this. (BroadcastReceiver, PhoneStateListener, etc...) show Toast. (ignore 'is null')

enter image description here

But I don't know how to Show Overlay when RINGING and hide when IDLE (Or connected). When I show Activity, It shows when calling is over.

How can I do that?

Code is like this

public class MyPhoneStateListener extends PhoneStateListener {
   Context context;
   Intent intent;

   public MyPhoneStateListener(Context context) {
       super();
       this.context = context;
   }

   @Override
   public void onCallStateChanged(int state, String incomingNumber) {
       switch (state) {
           case TelephonyManager.CALL_STATE_IDLE:
               // Hide popup
               break;
           case TelephonyManager.CALL_STATE_RINGING:
               // Show popup
               break;
           default:

               break;
       }
   }
  }

1 Answers1

1

You need a custom Toast and a BroadcastReceiver(as you rightly mentioned) There is a very good blogpost on how to customise a Toast in here: http://www.learn-android-easily.com/2013/05/customiozing-toast-in-android.html

hoomi
  • 1,882
  • 2
  • 16
  • 17