private void handleIntent(Intent intent) { // Special processing of the incoming intent only occurs if the action specified // by the intent is ACTION_SEARCH. if (Intent.ACTION_SEARCH.equals(intent.getAction())) { String query = intent.getStringExtra(SearchManager.QUERY); SearchRecentSuggestions suggestions = new SearchRecentSuggestions( this, SearchRecentSuggestionsProviderImpl.AUTHORITY, SearchRecentSuggestionsProviderImpl.MODE); suggestions.saveRecentQuery(query, null); if (mTwoPane) { TopTracksActivityFragment fragment = new TopTracksActivityFragment(); mUserLeaveHintCallback = fragment; getSupportFragmentManager() .beginTransaction() .replace(R.id.activity_fragment_top_tracks, fragment, TOPTRACKS_FRAGMENT_TAG) .commit(); } // do the actual search on the fragment MainActivityFragment mainActivityFragment = (MainActivityFragment) getSupportFragmentManager().findFragmentById(R.id.activity_fragment_main); mainActivityFragment.searchArtists(query); } }