I am trying to show an Activity (with Theme Dialog) over an Incoming call Screen to show some information. I am done with the that, but the problem is whenever the call comes, Activity Dialog pops up over it and it covers SLIDER ( for accepting/Rejecting calls) .
I want the Activity Dialog over Incoming call screen but still wants the user to pick/reject calls.
Moreover iff you see Toast behavior , it does not obstruct the behavior of incoming call screen.
Toasts are a special UI mechanism, it is hard to equate your UI to them. But it did get me thinking.
Toasts are sort of like timed modal dialogs. They actually do prevent interacting with the UI for a brief period of time (at least on my phones.) I know Android has Modal Dialog support (see http://developer.android.com/guide/topics/ui/dialogs.html). But do they have non-modal dialog support?
Turns out they do. There is a flag in the Windows Manager that can help: FLAG_NOT_TOUCH_MODAL. So you would use a Dialog to display your stuff, and when you make the dialog use myDialog.getWindow().setFlags() with the FLAG_NOT_TOUCH_MODAL flag.
See if that helps you out. I think when dialogs appear they actually dim the background making it hard to see what is around them (to keep your focus). I am sure this is also a Flag, probably in the same WindowManager.LayoutParams class.
I am already using this flag. This flag is used in order to send the user touch events to the windows behind it. But the problem is i cannot see the slider behind it, only slider is invisible, the other part ie the Incoming phone number is visible.
I have been playing around with it a bit, and had the same thing happen a few times - off and on, so I figured it was a timing issue. I added a Thread.sleep(1000) in the phone state listener before showing the Activity I overlayed on the screen and that seemed to make the thing behave smoother. This is in the emulator so a real phone may need less time (I didn't really try any value but 1000).
One thing I noticed is the Animation on the incoming call screen does not continue, but the control is there and functional.
Sahil Rally wrote:I tried , issue is not of timings, issue is not being able to touch the Slider behind since it disappears when my avtivity is launched over it. The problem still persists ....
Did you try the delay? As I said, in my code above I saw the same behavior. After analyzing it looks like the phone activity gets built in 3 parts. The background, the top portion where the person's picture/incoming info appears, and the bottom part where the answer/reject control sits. It seems (in my demo code) when the dialog appeared before one of the parts, that part would not show up, and it would be most likely to appear before the answer/reject section was visible.
The delay pushed the dialog to not show until after all components were made.
So, 2 things to try:
1) Add the delay before showing your activity
2) Try my code and see if you get different behavior