I want to create a popup window like the received SMS notification in Go SMS Pro (on top of all activities and also clickable).
I’ve been making several tries with Popup Windows, but nothing seems to work. Somehow I can’t control when the click is done to that “popup window”.
Thank you in advance.
WindowManager.LayoutParams params = new WindowManager.LayoutParams(
800, 800,
WindowManager.LayoutParams.TYPE_SYSTEM_ALERT,
WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM,
PixelFormat.TRANSLUCENT);
WindowManager wm = (WindowManager) getSystemService(WINDOW_SERVICE);
LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
View myView = inflater.inflate(R.layout.custom_toast, null);
myView.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View my, MotionEvent event) {
testeDisplay();
return false;
}
});
wm.addView(myView, params);
Why don’t use an acitvity as a dialog… Apply dialog theme to your activity.