简体   繁体   English

销毁Android中的活动问题

[英]Destroy activity Issues in Android

Hi I am using the button for bottom tab bar in android like iphone. 嗨,我正在使用iphone之类的Android底部标签栏按钮。 I have three screens and showing three button in all the screens. 我有三个屏幕,并且在所有屏幕中都显示三个按钮。 I used the below coding for each button in each screen. 我为每个屏幕中的每个按钮使用了以下代码。

Intent intentNavOne = new Intent(ScreenOne.this,
                    ScreenTwo.class);
            intentNavOne .addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
            intentNavOne .addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);

            intentNavOne .addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
            startActivity(intentNavOne );

Now the problem is some times the flow of the navigation changed. 现在的问题是导航流程有时已更改。 I just want the solution. 我只想要解决方案。 Any alternate way to achive my task.Thanks in advance. 实现我的任务的任何替代方法。

在您要开始新活动的活动中调用finish() ,这将停止该活动的生命周期。

As a developer I have faced same problem that you are facing now with the buttons to show tabs as in iphone and finally I switched to tabbars of android. 作为一个开发者,我面临的是你现在面临着同样的问题buttons显示选项卡在iphone,最后我切换到tabbars的Android。

I would suggest you that use tabbars instead of buttons as navigation will be very smooth you do not have to bother about previous activity . 我建议您使用tabbars而不是buttons因为导航将非常顺畅,您不必担心以前的activity

check below links for creating tabbars in android they are good tutorials 检查以下链接以在android中创建tabbars ,它们是很好的教程

link 1 链接1

link2 for action bars for 3.0 and above 适用于3.0及更高版本的操作栏的link2

let me know if you have more problems 让我知道您是否还有其他问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM