android conatcts搜索时偶现列表刷不出来

来源:互联网 发布:iris爱丽思授权淘宝店 编辑:程序博客网 时间:2024/05/02 02:15
<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);            }        }    };





0 0