如何在Android中实现SearchView

时间:2016-07-03 14:05:17

标签: java android android-recyclerview

我已根据SearchActivity创建RecyclerView,该ArrayList<>应搜索我在MainActivity

中声明的public class SearchActivity extends ListActivity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); handleIntent(getIntent()); } public void onNewIntent(Intent intent) { setIntent(intent); handleIntent(intent); } public void onListItemClick(ListView l, View v, int position, long id) { //DA IMPLEMENTARE: chiama accordo activity // do not care about this method, I'll implement it later } private void handleIntent(Intent intent) { if(Intent.ACTION_SEARCH.equals(intent.getAction())) { String query = intent.getStringExtra(SearchManager.QUERY); doSearch(query); } } private void doSearch(String queryStr) { // I think I should implement an adapter here } }
doSearch()

我想我应该在gst-launch-1.0 autovideosrc ! tee name = t ! queue ! omxh264enc ! 'video/x-h264, stream-format=(string)byte-stream' ! h264parse ! qtmux ! filesink name=fileSink location=test.mp4 t. ! queue ! videoscale ! video/x-raw, width=480,height=270 ! xvimagesink name=displaySink -e 方法中实现一些东西,但我不知道该怎么做。如果你能帮助我,我真的很感激

1 个答案:

答案 0 :(得分:1)

您应该使用Filter并在RecyclerView适配器上实现Filterable。检查此link。或者,如果您不想使用过滤方法,请选中此tutorials