mirror of
https://github.com/Etar-Group/Etar-Calendar.git
synced 2024-09-11 10:05:47 +03:00
Avoid crash if "Search Service" isn't available
This commit is contained in:
parent
b3286f2a23
commit
f6f87ab4e7
@ -1429,9 +1429,13 @@ public class Utils {
|
||||
* @param act The activity using the view
|
||||
*/
|
||||
public static void setUpSearchView(SearchView view, Activity act) {
|
||||
SearchManager searchManager = (SearchManager) act.getSystemService(Context.SEARCH_SERVICE);
|
||||
view.setSearchableInfo(searchManager.getSearchableInfo(act.getComponentName()));
|
||||
view.setQueryRefinementEnabled(true);
|
||||
try {
|
||||
SearchManager searchManager = (SearchManager) act.getSystemService(Context.SEARCH_SERVICE);
|
||||
view.setSearchableInfo(searchManager.getSearchableInfo(act.getComponentName()));
|
||||
view.setQueryRefinementEnabled(true);
|
||||
} catch (Exception e) {
|
||||
Log.d(TAG, "Search Service not found");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user