سؤال

I am implementing the search widget http://developer.android.com/guide/topics/search/search-dialog.html#UsingSearchWidget The search widget provides the same functionality as the search dialog. It starts the appropriate activity when the user executes a search, and it can provide search suggestions and perform voice search.

Everything works fine, I want to start the searchActivity without using the search widget and get the same result when clicking on one of the items bellow, how can I achieve that?

http://screencloud.net//img/screenshots/9b2638fbf1dd928abed678f9d3081479.png

So when I click lounge / nightclub it does the same as when I use the searchWidget(Restaurant)

هل كانت مفيدة؟

المحلول

You can start your search activity yourself like this:

Intent intent = new Intent(getActivity(), SearchActivity.class);
intent.putExtra(SearchManager.QUERY, "some text");
startActivityForResult(intent, 0);

Where SearchActivity is your activity implementing

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top