title: How to disable recreate fragment when rotate screen in Android
body: <p>In my application I used <code>NavigationComponent</code> for show <code>Fragments</code> and I used <code>ViewModel</code> !<br>
  But rotate the screen recreate fragment and remove all of position, recall again api and more...</p>
  <p>My Fragment codes:</p>
  <pre><code>    @AndroidEntryPoint
  class HomeFragment : Fragment() {
      //Binding
      private lateinit var binding: FragmentHomeBinding
  
      @Inject
      lateinit var genreAdapter: GenreAdapter
  
      @Inject
      lateinit var topMoviesAdapter: TopMoviesAdapter
  
      private val viewModel: HomeViewModel by viewModels()
  
      override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
          binding = FragmentHomeBinding.inflate(inflater, container, false)
          return binding.root
      }
  
      override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
          super.onViewCreated(view, savedInstanceState)
          //InitViews
          binding.apply {
              //Genres
              viewModel.genresList.observe(viewLifecycleOwner) {
                  genreAdapter.differ.submitList(it)
                  genresRecycler.initRecycler(
                      LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false),
                      genreAdapter
                  )
              }
              viewModel.loadGenresList()
              //Top movies
              viewModel.topMoviesList.observe(viewLifecycleOwner) {
                  topMoviesAdapter.differ.submitList(it.data)
                  topMoviesRecycler.initRecycler(
                      LinearLayoutManager(requireContext(), LinearLayoutManager.HORIZONTAL, false),
                      topMoviesAdapter
                  )
                  topMoviesRecycler.smoothScrollToPosition(4)
              }
              viewModel.loadTopMoviesList(1)
              //Loading
              viewModel.loading.observe(viewLifecycleOwner) {
                  if (it) {
                      homeLoading.showInvisible(true)
                  } else {
                      homeLoading.showInvisible(false)
                  }
              }
          }
      }
  }
  </code></pre>
  <p><strong>ViewModel codes:</strong></p>
  <pre><code>    @HiltViewModel
  class HomeViewModel @Inject constructor(private val repository: HomeRepository) : ViewModel() {
  
      val genresList = MutableLiveData&lt;List&lt;ResponseGenres.ResponseGenresItem&gt;&gt;()
      val topMoviesList = MutableLiveData&lt;ResponseMovies&gt;()
      val loading = MutableLiveData&lt;Boolean&gt;()
  
      fun loadGenresList() = viewModelScope.launch {
          val response = repository.genresList()
          if (response.isSuccessful) {
              genresList.postValue(response.body())
          }
      }
  
      fun loadTopMoviesList(id: Int) = viewModelScope.launch {
          loading.postValue(true)
          val response = repository.topMoviesList(id)
          if (response.isSuccessful) {
              topMoviesList.postValue(response.body())
          }
          loading.postValue(false)
      }
  }
  </code></pre>
  <p>How can I fix it and disable recreate Fragment?</p>