安卓应用程序 [英] Android Application ApK

查看:44
本文介绍了安卓应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个与 APK 相关的奇怪问题,即当我在使用签名导出后安装 apk 时,当我第一次在设备上安装它时,它工作正常,但如果我按下主页键,应用程序会进入后台,当我再次将其置于前台,它从头开始而不是从当前屏幕开始,但是如果我按下后退按钮结束应用程序并再次启动,那么它的行为是完美的,因为我定义的意思是,如果我在特定屏幕上并按下主页按钮并将应用程序发送到回到后台,然后将其放在前台,它显示了我将其发送到后台的特定活动.

I am having a strange issue related to APK that is when I install the apk after exporting it with signature and when I install it first time on device it it works fine but if I press home key app goes to background and when I bring it to foreground again it starts from the beginning not from the current screen but if i press back button end application and starts again then its behavior is perfect as I defined means if I m on a specific screen and press home button and send App to back ground and then bring it to fore ground it show the specific activity from where I send it to back ground.

有人有这种奇怪的行为吗?

Does any one have this strange behavior ?

在每个活动中我都添加了 onResume 方法.任何帮助将不胜感激.

In each activity I have added onResume Method. any help will be grateful.

推荐答案

这是 Android 中的一个长期存在的错误 :-( 当您使用安装程序或从 IDE(如 Eclipse 或 IntelliJ)安装应用程序时会发生这种情况或通过网络浏览器下载后.当应用程序像这样启动时,当用户返回主屏幕并再次启动应用程序时,Android 不会做它应该做的事情(即:将现有任务带到前台并让用户继续).相反,Android 将根活动再次启动到现有任务中.这对大多数应用程序造成了大量问题.

This is a long-standing bug in Android :-( This happens when you install the application using the installer, or from an IDE (like Eclipse or IntelliJ) or after download via web browser. When the application is launched like this, when the user returns to the HOME screen and launches the app again, Android doesn't do what it is supposed to do (ie: bring the existing task to the foreground and let the user continue). Instead, Android launches the root activity again into the existing task. This causes a ton of problems for most applications.

您无法采取任何措施来纠正这种行为.有一些方法可以检测到这一点,然后您可以做出相应的反应.请参阅以下内容:

There isn't anything you can do to correct the behaviour. There are some ways to detect this and then you can react accordingly. See the following:

Android 问题 - 1

Android 问题 - 2

Android 问题 - 3

当一个活动以不同的意图启动时,如何防止它出现多个实例

这篇关于安卓应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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