Android:活动对话框对话框意外消失

Android:活动对话框对话框意外消失,第1张

概述我有一个TabActivity应用程序,每当我从我的引擎(NDK C代码)获得回调时,我都会显示一个对话框.当应用程序处于恢复状态时,我确保显示对话框. 收到引擎回调后,我启动了NetworkDownDialog活动,但这会导致对话框停留一秒然后消失.如果我使用Dialog或AlertDialog,也会发生同样的事情.最奇怪的是,失踪似乎是随机的(并不总是发生). 这是一个S3设备.这是怎么回事? 我有一个tabactivity应用程序,每当我从我的引擎(NDK C代码)获得回调时,我都会显示一个对话框.当应用程序处于恢复状态时,我确保显示对话框.

收到引擎回调后,我启动了NetworkDownDialog活动,但这会导致对话框停留一秒然后消失.如果我使用Dialog或AlertDialog,也会发生同样的事情.最奇怪的是,失踪似乎是随机的(并不总是发生).

这是一个S3设备.这是怎么回事?

编辑于23/05/2013

网络向下对话代码

public class NetworkDownDialog extends Activity {    @OverrIDe    protected voID onCreate(Bundle savedInstanceState) {        super.onCreate(savedInstanceState);        setContentVIEw(R.layout.network_down);        Logger.d("NetworkDownDialog","----------onCreate-----------");        registerReceiver(mNetworkDownReceiver,new IntentFilter("NetworkDown"));    }    @OverrIDe    protected voID onDestroy() {        super.onDestroy();        unregisterReceiver(mNetworkDownReceiver);        Logger.d("NetworkDownDialog","------onDestroy-------");    }    @OverrIDe    protected voID onResume() {        super.onResume();        Logger.d("NetworkDownDialog","------onResume-------");    }    @OverrIDe    protected voID onRestart() {        super.onRestart();        Logger.d("NetworkDownDialog","------onRestart-------");    }    @OverrIDe    protected voID onStart() {        super.onStart();        Logger.d("NetworkDownDialog","------onStart-------");    }    @OverrIDe    protected voID onStop() {        super.onStop();        Logger.d("NetworkDownDialog","------onStop-------");    }    @OverrIDe    public voID onBackpressed() {        Logger.d("NetworkDownDialog","------onBackpressed Do nothing-------");    }    private broadcastReceiver mNetworkDownReceiver = new broadcastReceiver() {        @OverrIDe        public voID onReceive(Context context,Intent intent) {            finish();        }    };}

在日志中,这是我看到的:

05-15 20:48:02.981 D/NetworkDownDialog( 1050): ------onCreate-------05-15 20:48:02.981 D/alsa_ucm(  202): Setting mixer control: RX5 MIX1 INP2,value: RX205-15 20:48:02.991 D/alsa_ucm(  202): Setting mixer control: RX6 DSM MUX,value: DSM_INV05-15 20:48:02.991 D/alsa_ucm(  202): Setting mixer control: liNEOUT2 Volume,value: 10005-15 20:48:02.991 D/alsa_ucm(  202): Setting mixer control: liNEOUT4 Volume,value: 10005-15 20:48:02.991 D/NetworkDownDialog( 1050): ------onStart-------05-15 20:48:02.991 D/alsa_ucm(  202): Setting mixer control: RX5 Digital Volume,value: 6505-15 20:48:02.991 D/NetworkDownDialog( 1050): ------onResume-------

显示活动对话框

**05-15 20:48:05.073 W/inputdispatcher(  716): channel ~ Consumer closed input channel or an error occurred.  events=0x905-15 20:48:05.073 E/inputdispatcher(  716): channel ~ Channel is unrecoverably broken and will be disposed!**05-15 20:48:05.073 W/inputdispatcher(  716): Attempted to unregister already unregistered input channel05-15 20:48:05.083 I/SurfaceFlinger(  195): ID=2033 Removed IDx=5 MapSz=405-15 20:48:05.083 D/KeyguardVIEwMediator(  716): setHIDden false05-15 20:48:05.103 I/Adreno200-EGLSUB(  195): <CreateImage:897>: AndroID Image05-15 20:48:05.103 I/Adreno200-EGLSUB(  195): <GetimageAttributes:1106>: RGBA_8888**05-15 20:48:05.103 E/BufferQueue(  195): [mypackage.NetworkDownDialog] dequeueBuffer: SurfaceTexture has been abandoned!05-15 20:48:05.103 E/SurfaceTextureClIEnt( 1050): dequeueBuffer Failed (No such device**)05-15 20:48:05.103 D/Phonestatusbar(  894): addNotification score=005-15 20:48:05.123 E/VIEwRootImpl( 1050): Could not lock surface05-15 20:48:05.123 E/VIEwRootImpl( 1050): java.lang.IllegalArgumentException05-15 20:48:05.123 E/VIEwRootImpl( 1050):   at androID.vIEw.Surface.lockCanvasNative(Native Method)05-15 20:48:05.123 E/VIEwRootImpl( 1050):   at androID.vIEw.Surface.lockCanvas(Surface.java:88)05-15 20:48:05.123 E/VIEwRootImpl( 1050):   at androID.vIEw.VIEwRootImpl.drawSoftware(VIEwRootImpl.java:2314)05-15 20:48:05.123 E/VIEwRootImpl( 1050):   at androID.vIEw.VIEwRootImpl.draw(VIEwRootImpl.java:2277)05-15 20:48:05.123 E/VIEwRootImpl( 1050):   at androID.vIEw.VIEwRootImpl.performDraw(VIEwRootImpl.java:2145)05-15 20:48:05.123 E/VIEwRootImpl( 1050):   at androID.vIEw.VIEwRootImpl.performTraversals(VIEwRootImpl.java:1956)05-15 20:48:05.123 E/VIEwRootImpl( 1050):   at androID.vIEw.VIEwRootImpl.doTraversal(VIEwRootImpl.java:1110)05-15 20:48:05.123 E/VIEwRootImpl( 1050):   at androID.vIEw.VIEwRootImpl$TraversalRunnable.run(VIEwRootImpl.java:4472)05-15 20:48:05.123 E/VIEwRootImpl( 1050):   at androID.vIEw.Choreographer$CallbackRecord.run(Choreographer.java:725)05-15 20:48:05.123 E/VIEwRootImpl( 1050):   at androID.vIEw.Choreographer.doCallbacks(Choreographer.java:555)05-15 20:48:05.123 E/VIEwRootImpl( 1050):   at androID.vIEw.Choreographer.doFrame(Choreographer.java:525)05-15 20:48:05.123 E/VIEwRootImpl( 1050):   at androID.vIEw.Choreographer$FramedisplayEventReceiver.run(Choreographer.java:711)05-15 20:48:05.123 E/VIEwRootImpl( 1050):   at androID.os.Handler.handleCallback(Handler.java:615)05-15 20:48:05.123 E/VIEwRootImpl( 1050):   at androID.os.Handler.dispatchMessage(Handler.java:92)05-15 20:48:05.123 E/VIEwRootImpl( 1050):   at androID.os.Looper.loop(Looper.java:137)05-15 20:48:05.123 E/VIEwRootImpl( 1050):   at androID.app.ActivityThread.main(ActivityThread.java:4918)05-15 20:48:05.123 E/VIEwRootImpl( 1050):   at java.lang.reflect.Method.invokeNative(Native Method)05-15 20:48:05.123 E/VIEwRootImpl( 1050):   at java.lang.reflect.Method.invoke(Method.java:511)05-15 20:48:05.123 E/VIEwRootImpl( 1050):   at com.androID.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1004)05-15 20:48:05.123 E/VIEwRootImpl( 1050):   at com.androID.internal.os.ZygoteInit.main(ZygoteInit.java:771)05-15 20:48:05.123 E/VIEwRootImpl( 1050):   at dalvik.system.NativeStart.main(Native Method)

在这种情况下,ActivityDialog在上述之后消失了.

为什么我的对话框消失了?我的C级本机代码中的内存损坏是否可能导致此问题?我在UI方面做错了吗?我完全陷入困境……

编辑于24 -05 -2013

05-24 19:49:00.025 I/SurfaceFlinger( 1901): ID=2147 Removed Naintabactivity IDx=3 MapSz=405-24 19:49:00.025 I/SurfaceFlinger( 1901): ID=2147 Removed Naintabactivity IDx=-2 MapSz=4

SurfaceFlinger删除了我的tabactivity.这会导致对话框删除吗?

解决方法 >确保您正在显示带有应用程序上下文的对话框. >确保没有两个事件发生并触及代码的相同部分.当您要显示对话框时,c代码中的另一个事件将显示对话框. >确保您的应用程序有足够的内存来顺利运行. 总结

以上是内存溢出为你收集整理的Android:活动对话框/对话框意外消失全部内容,希望文章能够帮你解决Android:活动对话框/对话框意外消失所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1134329.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-30
下一篇 2022-05-30

发表评论

登录后才能评论

评论列表(0条)

保存