What happens in onSugggestionClick

时间:2016-08-31 18:55:05

标签: android

I have tried to understand the following code ,I know that this switches from one screen to another. I have read about getSuggestionAdapter()in the developer website, But I don't entirely understand what they mean.It says on the website that it "returns the adapter used for suggestions". Does this means it returns the details about the item? Also I read about intent.putExtra and its says that it "adds extended data to intent" .What data could that be?Thank you.

@Override
    public boolean onSuggestionClick(int position) {
        int id = (int) searchView.getSuggestionsAdapter().
                getItemId(position);

        Intent intent = new Intent(this, ProSearchActivity.class);

        intent.putExtra("id", id);

        startActivity(intent);

        return true;
    }

1 个答案:

答案 0 :(得分:1)

It just gives the data associated with the click position, letting you handle and use it in whichever way you like