0

我玩过 Google 示例的 Database Dictionary 示例。

它做这样的事情:

private void handleIntent(Intent intent) {
    if (Intent.ACTION_VIEW.equals(intent.getAction())) {
        // handles a click on a search suggestion; launches activity to show word
        Intent wordIntent = new Intent(this, WordActivity.class);
        wordIntent.setData(intent.getData());
        startActivity(wordIntent);
    } else if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
        // handles a search query
        String query = intent.getStringExtra(SearchManager.QUERY);
        showResults(query);
    }

我想用数据预先填充 UI(Google 示例有一个空列表)。查询应该是“*”。我怎样才能做到这一点?

4

1 回答 1

1

好的,我发现我必须添加这行代码

int count = cursor.getCount(); String countString = getResources().getQuantityString(R.plurals.search_results, count, new Object[] { count, query });

于 2013-03-04T22:01:11.233 回答