Question

In my app I have 2 activities, MainActivity and SecondActivity.

In MainActivity I have three tabs:-

  1. MapView
  2. ListView
  3. ListView [Which Opens a Dialog onItemClick and then redirects to different page]

The issues is in this scenario:-

  • Goto third tab and select any list item ,dialog opens[Works fine]
  • Now select any option and get redirected to Second activity
  • Do the operations on second screen
  • Now press back button we come back to the MainActivity with by default third tab opened [as we left from third tab]
  • Now select any other option from the list item on this third tab[ERROR!]. The screen color changes to transparent black color, also all the options if clicked at right position works fine. BUT THE DIALOG IS NOT VISIBLE.

THIS ONLY HAPPENS in 2.2, and 2.3 and 3.0 versions. If i change the tab and come back on third tab, then it works fine. Also note: The SecondActivity also has a full screen google map.

I doubt, this issue is occurring due to the GoogleMaps. Please help!

Thanks in advance.

Was it helpful?

Solution

I had a similar problem and managed to find a quick fix, although I am not sure you are exactly in my situation. But so be it:

My app uses a ViewAnimator, of which children are classic android layouts, except one which is a GlSurfaceView. I had the same problem as you have when invoking another activity (Swarm in my case) and coming back (concerning AlertDialogs and Spinner "pop-ups". Toasts were working).

Then I noticed the problem was actually due to my GLSurfaceView: I removed my other activity, and was able to reproduce the problem by going to the GLSurfaceView, going back to the menu, pressing home, and coming back to the application. While investigating I was able to find a quickfix when I noticed that my GLSurfaceView child was actually a LinearLayout with the GLSurfaceView Inside. When I removed the (useless) parent layout, my problem was completely gone.

I have no real clue why this happens, and I will investigate more later. But for me the surface view was the problem : http://developer.android.com/reference/android/view/SurfaceView.html "The surface is Z ordered so that it is behind the window holding its SurfaceView; the SurfaceView punches a hole in its window to allow its surface to be displayed.". Note that now, displaying another child with some null background just after the surface view child does not display the surface view where there is the black background (as if it was beneath), but simply displays black.

I guess that somehow the creation of the actual surface with its own z Under the window, the fact that AlertDialogs use z order, and the hiding/displaying of the activity create a complete mess.

If you do not have any GLSurfaceView this will probably not help you I think, but perhaps Google Maps use one? If so I am not sure how you can fix it but it can at least be a clue about what happens.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top