App Structure: My Main Activity is also acting as a Search Activity with a SearchView in the ActionBar. When I search in the ActionBar I handle it with onNewIntent in the Main Activity. When the intent is ACTION_SEARCH I replace the current fragment in MainActivity (possibly nothing or a previous search fragment) with a new search fragment which then creates an ASyncTask to fetch some data from an API which then creates another ASyncTask to get more details about the data and then populates a list view in the fragment.
Problem: after performing a search the SearchView field is empty and focused again.
Goal: I want the SearchView to not be focused and the SearchText to stay in case the user wants to change it.
What I have succeeded with is closing the action view (and removing focus) with MenuItemCompat.collapseActionView()
I've tried clearFocus() and setQuery() and several other methods I've found by googling but nothing seems to work. I've also tried using both in the onQueryTextSumbit function onQueryTextListener without success. I've looked at how other Apps like F-Droid and Simpletask Cloudless achieve it and most of them use filters on already existing data, whereas I am using ASyncTasks, which I think could be a source of the problem.