如何重复使用Android的意图 [英] How to reuse intents in Android

查看:91
本文介绍了如何重复使用Android的意图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好所有: 我创建中,我使用的菜单每一个屏幕,为用户导航的应用程序。在我的应用程序,我有屏蔽1 - >之际,主屏幕时,在用户登录 画面2 - >用户进入该屏幕来执行某些操作。现在,在画面2我想有菜单选项,让用户去主屏幕。 但开始的活动,我们做

Hello All: I am creating an application in which I am using menus on every screen for the user to navigate. In my application, I have Screen1--> comes as home screen when the user logs in Screen2--> user goes to this screen to perform some operations. Now on Screen2 I want to have menu option to let the user go to home screen. But to start the activity we do

startActivity(new Intent(Home.this, Screen2.class));

不过,我想用这是当所用的登入,然后使用onresume方法我可以更新主屏幕上创建的现有主屏幕。

But, I want to use the existing home screen which was created when the used logged in and then using onresume method I can update the home screen.

谁能告诉我如何利用现有的意图或活动提供菜单选项? 谢谢 Ashwani

Can anybody please tell me how to use the existing intents or activity to provide menu options? Thanks Ashwani

推荐答案

Ashwani,

我相信这可以用 <$完成C $ C> setFlags() 上打电话给你的意图使用<一个href="http://developer.android.com/reference/android/content/Intent.html#FLAG_ACTIVITY_REORDER_TO_FRONT"相对=nofollow> FLAG_ACTIVITY_REORDER_TO_FRONT 标志。如果屏幕1仍然存在,将其带到前台。该文件似乎并没有规定,但我相信它启动屏幕1的一个新的活动被杀害了。

I believe this can be done with a setFlags() call on your Intent using the FLAG_ACTIVITY_REORDER_TO_FRONT flag. If screen 1 still exists it will bring it to the foreground. The documentation doesn't seem to specify, but I assume it launches a new Activity of Screen 1 was killed.

这篇关于如何重复使用Android的意图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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