ActivityGroup的Group类抢度了子类焦点,使的子类不能处理onKeyDown事件,处理办法:
在子类中的一个组件,请求焦点,如:
View view = findViewById(R.id.medic);
//请求获取到焦点
view.requestFocus();
R.id.medic是一个LinearLayout
这样子类就可以捕获onKeyDow事件了,并进行事件处理了。
Activity之间数据共享有如下几种方式:
Shared Preferences
Store private primitive data in key-value pairs.
Internal Storage
Store private data on the device memory.
External Storage
Store public data on the shared external storage.
SQLite Databases
Store structured data in a private database.
Network Connection
Store data on the web with your own network server.
1.基于消息的通信机制 Intent ---boudle ,extra2. 利用static静态数据, public static成员变量;
3.基于外部存储的传输, File/Preference/ Sqlite ,如果要针对第三方应用需要Content Provider
4.基于IPC的通信机制
context 与Service之间的传输,如Activity与Service之间的通信,定义AIDL接口文件。
5. 基于Application Context
参考:http://blog.csdn.net/kieven2008/article/details/6006905
button2.PerformClick();能够自动单击