Reputation: 5231
I have created some activity which is transparent when some different app opens my activity starts and opens on top of that activity (Intent.FLAG_ACTIVITY_NEW_TASK).
What i am trying to achieve is what action happens on my activity will reflect to other activity.I mean when i scroll down underlaying view will scroll.
I could NOT do that i have used some flags combinations but it did not work.
I could not pass touch events both activities at the same time. It just works at one view, i need to do what happens on top (transparent) activity , underlaying activity has get to same events.
Window window = getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL);
window.addFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE);
// window.addFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL);
window.addFlags(WindowManager.LayoutParams.FLAG_SPLIT_TOUCH);
// window.addFlags(WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH);
//window.addFlags(WindowManager.LayoutParams.TYPE_PHONE);
setContentView(R.layout.trans);
final View v = getWindow().getDecorView().findViewById(android.R.id.content);
v.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
Log.i("TAG", View !!!!!!!!");
return false;
}
});
Upvotes: 3
Views: 1102
Reputation: 2537
You cannot do that with touch events, I am also not sure why would you want to do so.
That said, you can use local broadcasts or EventBus but it is a really bad idea, catch touch events in one Activity and pass to the other one after that.
Upvotes: 0
Reputation: 2319
This is not possible. You can neither inject input events to other apps' Activities nor can you receive their input events (known as tapjacking).
Upvotes: 2