首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > Android >

2011.09.01(四)——— android 应用程序跳转到桌面

2012-06-29 
2011.09.01(4)——— android 应用程序跳转到桌面2011.09.01(4)——— android 应用程序跳转到桌面public boolea

2011.09.01(4)——— android 应用程序跳转到桌面
2011.09.01(4)——— android 应用程序跳转到桌面

public boolean onKeyDown(int keyCode, KeyEvent event) {if (keyCode == KeyEvent.KEYCODE_BACK) {            Intent intent = new Intent(Intent.ACTION_MAIN);intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);intent.addCategory(Intent.CATEGORY_HOME); this.startActivity(intent);            return true;} else {return super.onKeyDown(keyCode, event);}}



相当于 按下了home键 1 楼 lina3427 2011-11-24   这个回到桌面,Launcher不会重新onCreate()吗? 2 楼 lipeng88213 2011-11-24   lina3427 写道这个回到桌面,Launcher不会重新onCreate()吗?
这个不清楚了  你测一下吧 3 楼 lina3427 2011-11-25   lipeng88213 写道lina3427 写道这个回到桌面,Launcher不会重新onCreate()吗?
这个不清楚了  你测一下吧

哦,测了一下,不会哦,因为本来从Launcher进入应用程序的时候就不会Destroy

那那,再请教一个问题:用这种方式回桌面不能用那个intent.putExtra()传值吗?我写的好像传不了呢,,??? 4 楼 lipeng88213 2011-11-28   lina3427 写道lipeng88213 写道lina3427 写道这个回到桌面,Launcher不会重新onCreate()吗?
这个不清楚了  你测一下吧

哦,测了一下,不会哦,因为本来从Launcher进入应用程序的时候就不会Destroy

那那,再请教一个问题:用这种方式回桌面不能用那个intent.putExtra()传值吗?我写的好像传不了呢,,???
假如说可以传值 那么也应该是键值对的键肯定是已经特定的吧

热点排行