I am new in Android. I am developing a kind of app locker. I want to start a fullscreen always on top Activity
that listens to onTouchEvent()
, when the user starts a locked app. I want to make user to get rid of that Activity
only if he/she enters a knock code as password. I have used following code to lock buttons by making Activity
always on top (Source: Creating a system overlay window (always on top)). But onTouchEvent()
does not receives any touches for knock code.
I have searched a lot and tried a lot of codes. But always one solution destroys other parts like current problem!
final WindowManager.LayoutParams params = new WindowManager.LayoutParams(
WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.TYPE_SYSTEM_ALERT ,
WindowManager.LayoutParams.FLAG_FULLSCREEN,
PixelFormat.TRANSPARENT);
WindowManager wm = (WindowManager) getApplicationContext().getSystemService(Context.WINDOW_SERVICE);
ViewGroup mTopView = (ViewGroup) getLayoutInflater().inflate(R.layout.activity_color, null);
getWindow().setAttributes(params);
wm.addView(mTopView, params);