Code example for ListFragment

Methods: onCreate, setRetainInstance

0
    private View progressView;
    private ArrayList<Message> messages;
 
    @Override 
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setRetainInstance(true);
        chat = chatFactory.create();
        messages = new ArrayList<Message>();
    } 
 
    @Override 
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.chat_translation, container, false);
        errorView = view.findViewById(R.id.chat_error_text);
        progressView = view.findViewById(R.id.progress_container);
        return view;
    } 
 
    @Override 
    public void onViewCreated(View view, Bundle savedInstanceState) {