一个HelloWorld,启动以后,看到"HelloWorld"字样,当你在模拟器点其它按钮,切到其它画面后,再也回不到"HelloWorld"字样的界面了。是不是程序就像是C环境下的控制台程序,main已经return结束了?
另外,我将res/layout/main.xml修改了一下,多了两个Edit,一个按钮。很明显,它需要停在此界面上,等待用户输入输出。一直不理解,android程序启动后,如果说没有结束,那模拟器如何再找回?
如果说结束了,又如何得知?<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="身高(cm)"
/>
<EditText android:id="@+id/height"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:numeric="integer"
android:text=""
/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="体重(kg)"
/>
<EditText android:id="@+id/height"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:numeric="integer"
android:text=""
/>
<Button android:id="@+id/submit"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="计算 BMI 值"
/>
<TextView android:id="@+id/result"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text=""
/>
<TextView android:id="@+id/suggest"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text=""
/>
</LinearLayout>
另外,我将res/layout/main.xml修改了一下,多了两个Edit,一个按钮。很明显,它需要停在此界面上,等待用户输入输出。一直不理解,android程序启动后,如果说没有结束,那模拟器如何再找回?
如果说结束了,又如何得知?<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="身高(cm)"
/>
<EditText android:id="@+id/height"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:numeric="integer"
android:text=""
/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="体重(kg)"
/>
<EditText android:id="@+id/height"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:numeric="integer"
android:text=""
/>
<Button android:id="@+id/submit"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="计算 BMI 值"
/>
<TextView android:id="@+id/result"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text=""
/>
<TextView android:id="@+id/suggest"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text=""
/>
</LinearLayout>
解决方案 »
- 求百度MP3地址解密
- android开发中流量监控中和中国移动通信的那个模块是怎么实现的。
- android调用带soapheader的webservice
- android 自动添加一个标签 并让此标签获得焦点
- [在线等]手机屏幕旋转的过程中,Activity的状态变化
- 如何更改应用程序的名称?
- 调试程序时,模拟器上的数据库一建立,第二次运行时也会存在。我想重新模拟应用首次运行时的场景,不知要怎么才能把这个数据库删除?
- 请问入门的app+后端学习资料
- Android 如何在EditText 中嵌入默认图片和文字?
- 魔秀桌面或者其他桌面助手是怎么修改其他app应用图标的
- 疑惑: Camera这个类也是继承了BnCameraClient,所以它可以做一个服务,而他的客户端访问在什么地方呢 ?
- 本人的毕业设计,急!!!
一般一个界面对应一个activity 如果你退出没将这个activity finish掉的话,activity仍保存在堆栈中,还可以返回到该界面。
如果自己想结束程序,activity可以调用finish,也可以执行System.exit(0); 或者android.os.Process.killProcess(android.os.Process.myPid())Android程序完全退出的三种方法一般情况,按back键退出的话,再次进入程序就是从头开始执行的。
按home键或者挂机键,应用就不会结束,会返回到上次的画面。
因为系统会回调onDestroy()函数