andriod第三课------Intent、后台服务与线程

快捷方式

ctl + 1 自动更正
ctl+/ 注释
ctl + shift+/ 块注释
ctl + shift+ 取消块注释

ctl+shift+o 自动导包

Alt +/ 自动补齐

ctl+shift+右键 打开命令行

adb shell 命令行

安装:adb install xxx.apk

cd data目录下可以看已经安装的APK包

卸载:adb uninstall xxx.apk

adb push xxx /sd/目录  将文件上传到

adb pull /sd/ xxx ./  将文件下载到当前目录

隐式Itent

用来实现页面跳转,Itent.setaction()可选择跳转到哪。

Service

后台进程,
startService()启动服务
stopService()停止服务

服务中跑线程

服务中的线程若果不退出,就算服务结束,也会重新启动服务,所以,服务的ondestroy()
方法中一定要做线程杀死操作。

注意:服务(也可以叫后台)的唤醒用startSevice(Intent).这个Intent是预先定义好的显式Intent,只要是显式Intent就得在manifast.xml中注册。

activity的四种启动模式

原文地址:https://www.cnblogs.com/xxg1992/p/6636396.html