Contacts 联系人查询过程:
protected void onCreate(Bundle icicle) {
if (UI.LIST_DEFAULT.equals(action)) {
mMode = MODE_DEFAULT; // 设置模式
setEmptyText(); //还未导入数据库的联系人之前,界面显示为
空。mAdapter = new ContactItemListAdapter(this);
setListAdapter(mAdapter);
getListView().setOnScrollListener(mAdapter); // 设置 ITEMLIST
// We manually save/restore the listview state
list.setSaveEnabled(false);
mQueryHandler = new QueryHandler(this); // 获取查询实例
mJustCreated = true; // 第一次打开标志
// TODO(jham) redesign this
mSyncEnabled = true;
}
// 重新执行
protected void onResume() {
boolean runQuery = true; // 查询标志
if (mMode == MODE_DEFAULT) {
// If we're in default mode we need to possibly reset the mode due to a change
// in the preferences activity while we weren't running
setDefaultMode(); // 设置模式
}
if (mJustCreated && runQuery) {
// We need to start a query here the first time the activity is launched, as long
// as we aren't doing a filter.
startQuery(); // 开始查询
}
mJustCreated = false;
}