运行android程序的时候提示:ActivityManager: Warning: Activity not started, its current task has been brought to the front

但是在模拟器上显示出了程序界面,后来google了一下,

有一组提问和回答引起了我的注意:

  1. Hi,
  2. I have a very simple android project. I got the following error message when I try to run it. The emulator is running but the application doesn't come up. I couldn't find any useful information online. Can anyone help me?
  3. Thanks,
  4. arning: Activity not started, its current task has been brought to the front public class Profile extends Activity { /Button button1; CheckBox check1, check2; EditText text1;/

Answer:

  1. Hi Lewis!
  2. It is not an error message, it is a warning. What the system is trying to tell you: The application on the device is the same as your application in Eclipse. And because the application is already running on the device, the system tells you that it is not going to kill and restart it, but bring the activity of your already running app into the foreground. This is pretty normal. ;-)
  3. The warning will not continue if you edit your code and run it (because the app is then killed, reinstalled and started) or if you kill your process on the phone, e.g. via the DDMS.

解释:

这个不是Android平台的Bug,而是Android本身就是这样一种处理机制。

们在Android平台下,通过返回按钮,或者程序本身的退出操作,去结束一个进程的时候,实际上Android虚拟机未必会将这个进程真正的结束掉,在
内存允许的情况下,这个程序会以缓存的形式存在Android虚拟机中。只有在内存不足的情况下时,Android系统会清理长时间不被激活的任务,以为
其他程序提供内存。
Android这样做,是为了你下一次更加快速的启动这个程序。
所以,出现楼主这种情况,是在你的程序没有发生任何变化,并且内存足够的情况下,会将上一次执行的程序,从缓存Cached状态直接放置到任务栈的顶端,则你的程序又可以继续执行了。

消除警告解决办法:

退出虚拟机的程序从新运行一遍。

最新文章

  1. Ruby 方法
  2. mysql本地可以访问 网络不能访问
  3. ProgressBar.js – 漂亮的响应式 SVG 进度条
  4. WPF快速精通版
  5. 页面静态化2 --- 使用PHP缓存机制来完成页面静态化(上)(ob_flush和flush函数区别用法)
  6. 解决Maven不能下载“oracle、aspectjweaver、com.springsource.net.sf.cglib”jar
  7. 如何用jQuery实现在鼠标滚动后导航栏保持固定
  8. 《物联网框架ServerSuperIO教程》-19.设备驱动和OPC Client支持mysql、oracle、sqlite、sqlserver的持久化。v3.6.4版本发布
  9. 定位--position属性
  10. C#高性能大容量SOCKET并发(八):通讯协议
  11. Dynamics CRM2013 1:N关系 sub-grid中的“添加现有项”和“添加新建项”功能详解
  12. linux虚拟机关机、重启命令
  13. Windows Server 2016-Win Ser 2016已删减内容
  14. Dirichlet's Theorem on Arithmetic Progressions POJ - 3006 线性欧拉筛
  15. day10--进程
  16. 【转】Java异常总结和Spring事务处理异常机制浅析
  17. sqljdbc4.jar的安装
  18. 微信网页JS分享,微信二次分享无缩略图问题
  19. ASP.NET MVC学习(五)之MVC原理解析
  20. C++ 把枚举变量的名称,直接当字符串使用方法 字符串化符号 #

热门文章

  1. FolderBrowserDialog 成员
  2. C# \uxxx Unicode编码解码
  3. 关于在js中使用csstext的问题
  4. Codeforces Round #241 (Div. 2)->A. Guess a number!
  5. uva 10859
  6. spoj 78
  7. PHPer 为什么会被 Javaer 鄙视?
  8. Using command-line Subversion to access project source files
  9. C# 面向对象之概念理解(2)
  10. hdu 2065 "红色病毒"问题