From 63cbc35cfcfe4630a6a304844c26f24410a12190 Mon Sep 17 00:00:00 2001 From: M66B Date: Mon, 20 Oct 2014 15:19:40 +0200 Subject: [PATCH] Workaround missing search view Refs #2037 --- src/biz/bokhorst/xprivacy/ActivityMain.java | 46 +++++++++++---------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/src/biz/bokhorst/xprivacy/ActivityMain.java b/src/biz/bokhorst/xprivacy/ActivityMain.java index ee7eeaaa4..c95f9b9e2 100644 --- a/src/biz/bokhorst/xprivacy/ActivityMain.java +++ b/src/biz/bokhorst/xprivacy/ActivityMain.java @@ -485,29 +485,31 @@ public boolean onCreateOptionsMenu(Menu menu) { // Searchable SearchView searchView = (SearchView) menu.findItem(R.id.menu_search).getActionView(); - searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { - @Override - public boolean onQueryTextChange(String newText) { - searchQuery = newText; - applyFilter(); - return true; - } + if (searchView != null) { + searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { + @Override + public boolean onQueryTextChange(String newText) { + searchQuery = newText; + applyFilter(); + return true; + } - @Override - public boolean onQueryTextSubmit(String query) { - searchQuery = query; - applyFilter(); - return true; - } - }); - searchView.setOnCloseListener(new SearchView.OnCloseListener() { - @Override - public boolean onClose() { - searchQuery = ""; - applyFilter(); - return true; - } - }); + @Override + public boolean onQueryTextSubmit(String query) { + searchQuery = query; + applyFilter(); + return true; + } + }); + searchView.setOnCloseListener(new SearchView.OnCloseListener() { + @Override + public boolean onClose() { + searchQuery = ""; + applyFilter(); + return true; + } + }); + } return true; } else