Posts

Showing posts from December, 2019

Search in a Listview

Image
The code for searching the items in a Listview is: listview1.setTextFilterEnabled (true); } @Override public boolean onCreateOptionsMenu(Menu menu) { SearchView mSearchView = new SearchView(getSupportActionBar().getThemedContext()); mSearchView.setQueryHint("Search Here"); mSearchView.setOnQueryTextListener(new SearchView.OnQueryTextListener(){ @Override public boolean onQueryTextSubmit(String query) { return false; } @Override public boolean onQueryTextChange(String newText){ if (TextUtils.isEmpty(newText)) { listview1.clearTextFilter(); } else { listview1.setFilterText(newText); } return true; } }); menu.add("Search") .setIcon(R.drawable.search) .setActionView(mSearchView) .setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW); return true; Listview1 is the listview id you can change that as per your choice. The video tutorial for this is: 

How to Enable Drawer without Enabling ActionBar in Sketchware

Image
The code for hiding ActionBar in Sketchware is: if(_abshown==true  ){ getSupportActionBar().show(); }else{ if(_abshown==false){ getSupportActionBar().hide(); }else{ } } This code must be placed in the MoreBlock. The MoreBlock must be created with a boolean variable. Then place the MoreBlock in OnCreate Activity and make the boolean variable False. For detailed explanation follow the Video.