I needed to enter Fragment
to execute this method Verifcar()
on main Activity
to check the condition and not show RecyclerView
.
MainActivity.Java
public void Verificar(){
if(pref.getBoolean(Constants.IS_LOGGED_IN,false)){
recyclerView.setVisibility (View.VISIBLE);
}else {
recyclerView.setVisibility (View.INVISIBLE);
}
}