0

I'm fully aware that this question has been asked before, in 2 instances: Display Map v2 in popup Window not display in android? Transparent Google Map on PopupWindow?

I want to add some information, but after I edited the second question, my edit disappeared from my view, so I guess someone rejected it or something.

In my case:
1. The API key is NOT wrong. The map is displayed perfectly fine on a Nexus 10, inside the popup, and in an Android 4.0.3 device, in a separate activity.
2. The SupportMapFragment is working fine if placed in a new activity, and is NOT working when placed inside a PopupWindow. The only clue I have is the following LogCat output:

12-12 18:45:52.362: WARN/WindowManager(158): Failed looking up window
    java.lang.IllegalArgumentException: Requested window android.os.BinderProxy@4139e958 does not exist
    at com.android.server.wm.WindowManagerService.windowForClientLocked(WindowManagerService.java:7168)
    at com.android.server.wm.WindowManagerService.windowForClientLocked(WindowManagerService.java:7159)
    at com.android.server.wm.WindowManagerService.performDeferredDestroyWindow(WindowManagerService.java:2839)
    at com.android.server.wm.Session.performDeferredDestroy(Session.java:167)
    at android.view.IWindowSession$Stub.onTransact(IWindowSession.java:205)
    at com.android.server.wm.Session.onTransact(Session.java:111)
    at android.os.Binder.execTransact(Binder.java:338)
    at dalvik.system.NativeStart.run(Native Method)

I read here that it's probably due to the device's API not supporting the call being made, but I don't know why. I repeat, the Map inside the PopupWindow works fine on my Nexus 10 (running Android 4.4) but not on the tablet from work, which runs Android 4.0.3.

Community
  • 1
  • 1
Daniel Gray
  • 1,697
  • 1
  • 21
  • 41
  • 1
    Have you tried to add some layout as `PopupWindow` content view as fragment container and then attach the fragment? Are you showing the popup too early? If so, show it once the activity window completely shows up (Runnable) – Nikola Despotoski Dec 12 '13 at 18:22
  • @NikolaDespotoski I'm showing the `PopupWindow` at the press of a button, so I'm pretty sure that the Activity is fully drawn. Your idea of the PopupWindow as the fragment container sounds interesting... I tried `getContentView().getSupportFragmentManager()` but that method isn't defined. The `SupportMapFragment` is inflated into the view with XML, not added dynamically. How would I do what you're saying? – Daniel Gray Dec 13 '13 at 01:14
  • 1
    Something like this: Assume you have xml where you have `LinearLayout` with id `R.id.popup_window_fragment_holder`. Use `popUpWindow.setContentView(context.inflate(R.layout.popupfragment);` Now use your Activity to `getSupportFragmentManager()`, do all regular fragment stuff and then `fragmentTransaction.replace(R.id.popup_window_fragment_holder, mapFragment);` Better? – Nikola Despotoski Dec 13 '13 at 01:21
  • I tried what you said, but the activity can't find the fragment container view. `geoLocatorView = context.getLayoutInflater().inflate(R.layout.fragment_geolocator,null); mGMapFragment = SupportMapFragment.newInstance(); containerView.addView(geoLocatorView);context.getSupportFragmentManager().beginTransaction().add(R.id.mapFragmentContainer,mGMapFragment).commit();` And I get: `ERROR/FragmentManager(10593): No view found for id 0x7f060017 (com.nouvelletech.PoliceAppDemo:id/mapFragmentContainer) for fragment SupportMapFragment{413f1888 #0 id=0x7f060017}` – Daniel Gray Dec 13 '13 at 02:10
  • @NikolaDespotoski sorry, I forgot to tag you in my previous response... if there are no more ideas, I thank you for your time!! – Daniel Gray Dec 13 '13 at 05:25

0 Answers0