I was trying to get the input connection of a SearchView. I wanna do this b/c i have an in app keyboard and whenever the user wants to search i will display my in app keyboard. For that purpose i am supposed to get the input connection of the SearchView using the method onCreateInputConnection, however the method is returning null for the SearchView, but it’s working fine for EditText. Also, i am using the SearchView on the navigation bar as a menu item.
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.options_menu_advanced_search, menu);
SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
SearchView searchView = (SearchView) menu.findItem(R.id.search).getActionView();
CustomAmharicKeyboard customAmharicKeyboard = findViewById(R.id.keyboard);
customAmharicKeyboard.setVisibility(View.VISIBLE);
InputConnection inputConnection = searchView.onCreateInputConnection(new EditorInfo());
customAmharicKeyboard.setInputConnection(inputConnection);
}