Source:
<code>public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.log_menu, menu); MenuItem searchItem = menu.findItem(R.id.menu_search); SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); if (searchItem != null) { searchView = (SearchView) searchItem.getActionView(); } if (searchView != null) { searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName())); } <START> if (searchView == null) { <END> return true; } SearchView.SearchAutoComplete searchAutoComplete = searchView.findViewById(R.id.search_src_text); if (searchView != null && mCurrentFilter != null && !mCurrentFilter.equals("")) { if (searchAutoComplete != null) { searchAutoComplete.setText(mCurrentFilter); } searchView.setIconified(false); } else { if (searchAutoComplete != null) { searchAutoComplete.setText(""); } searchView.setIconified(true); } final SearchView.OnQueryTextListener queryTextListener = new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextChange(String newText) { setFilter2LogAdapter(newText); return true; } @Override public boolean onQueryTextSubmit(String query) { setFilter2LogAdapter(query); return true; } }; if (searchItem != null) { searchItem.setOnActionExpandListener(new MenuItem.OnActionExpandListener() { @Override public boolean onMenuItemActionCollapse(MenuItem item) { setFilter2LogAdapter(""); return true; } @Override public boolean onMenuItemActionExpand(MenuItem item) { return true; } }); } if (null != searchView) { searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName())); searchView.setIconifiedByDefault(true); searchView.setOnQueryTextListener(queryTextListener); if (mCurrentFilter != null && !mCurrentFilter.equals("")) { if (searchAutoComplete != null && searchItem != null) { searchItem.expandActionView(); searchAutoComplete.setText(mCurrentFilter); } } } return true; }</code><technical_language>else previous condition if (searchView != null)</technical_language>

Target:
public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.log_menu, menu); MenuItem searchItem = menu.findItem(R.id.menu_search); SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); if (searchItem != null) { mSearchView = (SearchView) searchItem.getActionView(); } if (mSearchView == null) { return true; } if (searchManager != null) { mSearchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName())); } SearchView.SearchAutoComplete searchAutoComplete = mSearchView.findViewById(R.id.search_src_text); if (mCurrentFilter != null && !mCurrentFilter.equals("")) { if (searchAutoComplete != null) { searchAutoComplete.setText(mCurrentFilter); } mSearchView.setIconified(false); } else { if (searchAutoComplete != null) { searchAutoComplete.setText(""); } mSearchView.setIconified(true); } final SearchView.OnQueryTextListener queryTextListener = new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextChange(String newText) { setFilter2LogAdapter(newText); return true; } @Override public boolean onQueryTextSubmit(String query) { setFilter2LogAdapter(query); return true; } }; if (searchItem != null) { searchItem.setOnActionExpandListener(new MenuItem.OnActionExpandListener() { @Override public boolean onMenuItemActionCollapse(MenuItem item) { setFilter2LogAdapter(""); return true; } @Override public boolean onMenuItemActionExpand(MenuItem item) { return true; } }); } if (null != mSearchView) { if (searchManager != null) { mSearchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName())); } mSearchView.setIconifiedByDefault(true); mSearchView.setOnQueryTextListener(queryTextListener); if (mCurrentFilter != null && !mCurrentFilter.equals("")) { if (searchAutoComplete != null && searchItem != null) { searchItem.expandActionView(); searchAutoComplete.setText(mCurrentFilter); } } } return true; }