I have a search view on my Main Activity, i want to pass the submitted string from MainActivity to SearchFragment.
@Override
public boolean onQueryTextSubmit(String query) {
   Bundle bundle = new Bundle();
   bundle.putString("searchTitle", query);
   SearchFragment searchFragment = new SearchFragment();
   searchFragment.setArguments(bundle);
   Intent mIntent = new Intent(MainActivity.this, SearchActivity.class);
   startActivity(mIntent);
   return true;
}
But i get NullPointerException when i try to get the data in the SearchFragment
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    strText = getArguments().getString("searchTitle");
    return inflater.inflate(R.layout.fragment_movies, container, false);
}
How can i fix this ?
 
     
     
    