in my fragment, my button changes it's visibility to GONE whenever I click on it. I want the visibility to remain GONE when i rotate my screen. I am using onSaveInstanceState but I would like help on what to add in for the outState.
Any help would be greatly appreciated, thanks!
public class PlaylistsFragment extends Fragment {
private Button add1;
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_playlists, container, false);
}
@Override
public void onSaveInstanceState(@NonNull Bundle outState) {
super.onSaveInstanceState(outState);
outState.
}
@Override
public void onViewCreated(final View view, @Nullable final Bundle savedInstanceState) {
final Button add1 = (Button) getView().findViewById(R.id.p_add1);
add1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
add1.setVisibility(View.GONE);
}
});
}
}