As many of us know that when turning the screen of the phone or tablet what the application does is to load the activity again, I need to detect that turn and change the value of the GridLayoutManager and pass it to the recyclerview, the content that my app loads it does from an xml on a server and the whole process is inside an Asyntask, in the onPostExecute method I created the GridLayoutManager and passed it to the recyclerview. Thanks in advance for the help, I leave part of the code where I need collaboration.
@Override
protected void onPostExecute(Void aVoid) {
super.onPostExecute(aVoid);
progressBar_home.setVisibility(View.INVISIBLE);
GridLayoutManager gridLayoutManager = new GridLayoutManager(getApplicationContext(), 2);
mRecycler.setLayoutManager(gridLayoutManager);
mRecycler.setAdapter(adapter);
}
I need to pass the spanCount from 2 to 3.
GridLayoutManager gridLayoutManager = new GridLayoutManager(getApplicationContext(), 2);