Android的 - 2活动活跃的同时 [英] Android - 2 Activities active at the same time

查看:113
本文介绍了Android的 - 2活动活跃的同时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个GameActivity。我也有跑在最前面的透明ChatActivity如果用户presses从菜单(onOptionsItemSelected)的聊天选项。问题是,当玩家开始ChatActivity之前,我开始游戏,一个奇怪的行为发生,游戏将不会启动。

I have a GameActivity. I also have a transparent ChatActivity running on top if the user presses the Chat options from the Menu (onOptionsItemSelected). The problem is, when a player starts the ChatActivity before I start the game, an odd behavior occurs and the game won't start.

有没有什么办法可以让GameActivity活跃,而ChatActivity是可见的? 我发射了ChatActivity用正常的方式:

Is there any way I can keep GameActivity active while ChatActivity is visible? I fired up the ChatActivity using the normal way:

startActivity(new Intent(GameActivity.this, ChatActivity.class));

感谢您的帮助。

Thanks for your help.

推荐答案

您不能在一个活动的两项活动。然而;一个设计你可能实现的是引入的设计,让用户在滑动屏幕带来了相反的方向躲查看聊天视图和刷卡。

You can't have two activities in one activity. However; one design you could possibly achieve is introduce a design that allows the user to swipe the screen to bring up the chat view and swipe in the opposite direction to hide the view.

有正在运行通过异步过程维持这一观点,这样就可以根据需要进行更新,并不会不会中断用户的主要活动。

Have the main Activity that is running maintain that view via an async process so that it can be updated as necessary and does NOT interrupt the user.

这篇关于Android的 - 2活动活跃的同时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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