显示一个Android PopupWindow超过NativeActivity的 [英] Showing an Android PopupWindow over a NativeActivity

查看:602
本文介绍了显示一个Android PopupWindow超过NativeActivity的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想我已经使用NDK和SDL移植安卓游戏来实现的AdMob。我一直在下面的例子中 rel=\"nofollow\">,但是当我打电话showAdPopup,我的游戏的活动似乎被摧毁,我留下了一个空白的灰色屏幕,在底部的广告。日志似乎表明我的活动显示在弹出窗口时被暂停。

I'm trying to implement AdMob in my Android game which has been ported using the NDK, and SDL. I've been following the example here, but when I call showAdPopup, my game's Activity seems to be destroyed, I'm left with a blank grey screen, with an ad at the bottom. The logs seem to show my activity being paused when the popup window is shown.

我注释掉所有的AdMob code的,似乎这个问题是可重复的只是努力创造了我一个NativeActivity的PopupWindow。我注意到有一个示例应用程序<一href=\"https://android.googlesource.com/platform/development/+/f39a078023bd2f89212f352624eb2c5830c45496/ndk/platforms/android-18/samples/Teapot/src/com/sample/teapot/TeapotNativeActivity.java\"相对=nofollow>这里具有几乎相同的code矿,但样品已经从更高版本的SDK(我针对Android的-19)。消失

I've commented out all of the admob code and it seems that the problem is reproducible just by trying to create a PopupWindow over my NativeActivity. I noticed there is a sample app here which has almost identical code to mine, but that sample has disappeared from the SDK in later versions (I'm targeting android-19).

有谁知道为什么我的祖国活动似乎暂停/关机,当我尝试推出一个popupwindow?在android系统-19做了一些改变,从工作停止这种做法?

Does anyone know why my native activity seems to pause/shutdown when I try to launch a popupwindow? Did something change in android-19 that stops this approach from working?

推荐答案

原来,通过调用:

_activity.setContentView(mainLayout, params);

我被破坏SDL上下文。解决的办法是使用现有的布局,SDL的活动创建和弹出窗口添加到

I was destroying the SDL context. The solution is to use the existing layout that SDL's activity creates and add the popup window to that.

这篇关于显示一个Android PopupWindow超过NativeActivity的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆