本文主要是介绍android conatcts搜索时偶现列表刷不出来,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
<pre name="code" class="java">关键函数:
511 private void startLoadingDirectoryPartition(int partitionIndex) {
512 DirectoryPartition partition = (DirectoryPartition)mAdapter.getPartition(partitionIndex);
513 partition.setStatus(DirectoryPartition.STATUS_LOADING);
514 long directoryId = partition.getDirectoryId();
515 if (mForceLoad) {//一直调用if语句,没有调用else,应该调用else就可以利用<pre name="code" class="java"> 延时读取队列来修复
516 if (directoryId == Directory.DEFAULT) {
517 loadDirectoryPartition(partitionIndex, partition);
518 } else {
519 loadDirectoryPartitionDelayed(partitionIndex, partition);
520 }
521 } else {
522 Bundle args = new Bundle();
523 args.putLong(DIRECTORY_ID_ARG_KEY, directoryId);
524 getLoaderManager().initLoader(partitionIndex, args, this);
525 }
526 }
逻辑调用:
private static final int DIRECTORY_SEARCH_MESSAGE = 1; private void loadDirectoryPartitionDelayed(int partitionIndex, DirectoryPartition partition) { mDelayedDirectorySearchHandler.removeMessages(DIRECTORY_SEARCH_MESSAGE, partition); Message msg = mDelayedDirectorySearchHandler.obtainMessage( DIRECTORY_SEARCH_MESSAGE, partitionIndex, 0, partition); mDelayedDirectorySearchHandler.sendMessageDelayed(msg, DIRECTORY_SEARCH_DELAY_MILLIS); } private Handler mDelayedDirectorySearchHandler = new Handler() { @Override public void handleMessage(Message msg) { if (msg.what == DIRECTORY_SEARCH_MESSAGE) { loadDirectoryPartition(msg.arg1, (DirectoryPartition) msg.obj); } } };
这篇关于android conatcts搜索时偶现列表刷不出来的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!