运行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状态直接放置到任务栈的顶端,则你的程序又可以继续执行了。

消除警告解决办法:

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

ActivityManager: Warning: Activity not started, its current task has been brought to the front 的的问题的更多相关文章

  1. JAVA Eclipse ActivityManager Warning Activity not started, its current task has been brought to the front怎么办

    Eclipse运行提示Activity not started,因为当前程序已经在运行,需要退出当前程序再测试

  2. 问题: ActivityManager: Warning: Activity not started, its current task has been brought to the front

    运行程序时看控制台有这样的错误,应用程序没跑起来. 解决办法:project-->Clean

  3. 出现错误ActivityManager: Warning: Activity not started, its current task has been

    1.在学习两个Activity的切换时,重新把新的工程部署上模拟器时候出现错误:ActivityManager: Warning: Activity not started, its current ...

  4. Activity not started, its current task has been brought to the front

    运行错误:Activity not started, its current task has been brought to the front . 原因分析:因为你的模拟器中还有东西在运行,也就是 ...

  5. Activity not started, its current task has been brought to the front的解决办法

    删除bin目录下所有文件,重新启动在试试

  6. (转载)activity外部调用startActivity的new task异常解析

    activity外部调用startActivity的new task异常解析 泡在网上的日子 / 文 发表于2013-09-07 12:45  第1314次阅读 异常,android,activity ...

  7. ActivityJump+ActivityManager【Activity之间的跳转和Activity任务栈管理】

    版权声明:本文为HaiyuKing原创文章,转载请注明出处! 前言 封装Activity跳转的方法以及实现Activity任务栈管理. 效果图   代码分析 ActivityJump:封装Activi ...

  8. android开发中经常遇到的问题汇总

    大家都在为项目开发成功而喜悦,但可不知成功的路上是会经常出错的,下面是我碰到的一些错误集合! [错误信息] [2011-01-19 16:39:10 - ApiDemos] WARNING: Appl ...

  9. Android虚拟机运行问题之小结

    首先说一下关于虚拟机的技巧,以前我也总是感觉电脑运行虚拟机的时候老是卡,后来在看课堂直播时看到老师用的是Total Control,在网上搜“Total Control”就能能找到,比系统自带SDK运 ...

随机推荐

  1. Codeforces Bubble Cup 8 - Finals [Online Mirror] B. Bribes lca

    题目链接: http://codeforces.com/contest/575/problem/B 题解: 把链u,v拆成u,lca(u,v)和v,lca(u,v)(v,lca(u,v)是倒过来的). ...

  2. OpenLDAP配置信息记录

    随着各种研发工具使用越来越多,单独为每个工具维护一个账号系统的开销越来越大,而且作为用户多个账号密码使用也越来越不方便.所以需要做一个统一账号登陆. 查询了多个方法,又因为之前用过LDAP,所以选择了 ...

  3. DVB系统几种传输方式

    卫星 (DVB-S 及 DVB-S2)有线 (DVB-C)地面无线 (DVB-T)手持地面无线 (DVB-H)

  4. Android中使用HTTP和HttpClient进行通信

    /** * 使用HTTP的Get方式进行数据请求 */ protected void httpGet() { /** * 进行异步请求 */ new AsyncTask<String, Void ...

  5. 【零基础学习iOS开发】【02-C语言】05-进制

    上一讲简单介绍了常量和变量,这讲补充一点计算机的基础知识---进制. 我们先来看看平时是如何表示一个整数的,最常见的肯定是用阿拉伯数字表示,比如“十二”,我们可以用12来表示,其实这种表示方式是基于一 ...

  6. Project Euler 99:Largest exponential 最大的幂

    Largest exponential Comparing two numbers written in index form like 211 and 37 is not difficult, as ...

  7. 【memcache缓存专题(1)】memcache的介绍与应用场景

    简介 Memcached是一个高性能的分布式的内存对象缓存系统,目前全世界不少人使用这个缓存项目来构建自己大负载的网站,来分担数据库的压力,通过在内存里维护一个统一的巨大的hash表,它能够用来存储各 ...

  8. linux 线程的内核栈是独立的还是共享父进程的?

    需要考证 考证结果: 其内核栈是独立的 206 static struct task_struct *dup_task_struct(struct task_struct *orig) 207 { 2 ...

  9. jvm调优具体参数配置

    3.JVM参数 在JVM启动参数中,可以设置跟内存.垃圾回收相关的一些参数设置,默认情况不做任何设置JVM会工作的很好,但对一些配置很好的Server和具体的应用必须仔细调优才能获得最佳性能.通过设置 ...

  10. java io知识点汇总FIle类

    1.路径分隔符问题: 因为java有跨平台行,而在windows和linux中的目录分隔符是不同的.windows是"\" 而linux是"/"  所以必须想办 ...