title: Error lateinit property adapter has not been initialized after come back from activity
body: <p>I've a problem with this code. After adding the code for the SearchView, every time that I click on one element going to StoreActivity, when I come back I receive the error </p>
  
  <blockquote>
    <p>kotlin.UninitializedPropertyAccessException: lateinit property adapter has not been initialized</p>
  </blockquote>
  
  <p>on row </p>
  
  <blockquote>
    <p>adapter.filter.filter(newText)</p>
  </blockquote>
  
  <p>How I can resolve this error? I don't understand...</p>
  
  <pre><code>class HomeFragment : BaseFragment() {
  
      private lateinit var adapter: MyStoreRecyclerViewAdapter
      private var stores: List&lt;StoreRealm&gt; = ArrayList()
  
      override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
  
          return inflater.inflate(R.layout.fragment_home, container, false)
      }
  
      override fun onResume() {
          super.onResume()
          setHasOptionsMenu(true)
  
          if (isAdded) {
              val systemService = this.context.getSystemService(Context.LOCATION_SERVICE) as LocationManager
              BLocationManager(this.context).getLocation {
                  loadHome()
                  if (!systemService.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
                      showEnableGpsDialog()
                  } else {
                      gpsWarning.visibility = View.GONE
                  }
              }
          }
      }
  
      override fun onCreateOptionsMenu(menu: Menu?, inflater: MenuInflater?) {
          inflater?.inflate(R.menu.search_store, menu)
          val search: MenuItem = menu!!.findItem(R.id.searchStore)
          val searchView: SearchView = search.actionView as SearchView
          search(searchView)
          searchView.maxWidth = Int.MAX_VALUE
  
          super.onCreateOptionsMenu(menu, inflater)
      }
  
      private fun loadHome() {
          loading_spinner?.visibility = View.VISIBLE
          StoreService.getStores(
              AuthManager.getMe()?.id!!, 0, BLocationManager.lat, BLocationManager.lon
          ) { response -&gt;
              loading_spinner?.visibility = View.GONE
              if (response.getResult() != null &amp;&amp; response.getResult()?.isNotEmpty()!!) {
                  no_data_view?.visibility = View.GONE
                  store_view?.visibility = View.VISIBLE
  
                  stores = response.getResult()!!
                  // set up the RecyclerView
                  val recyclerView = view.store_recycler
                  recyclerView.layoutManager = GridLayoutManager(this.context, 1)
                  adapter = MyStoreRecyclerViewAdapter(stores) {
                      val intent = Intent(this.context, StoreActivity::class.java)
                      intent.putExtra("store_id", it.id)
                      startActivity(intent)
                  }
                  recyclerView.adapter = adapter
              } else {
                  no_data_view?.visibility = View.VISIBLE
                  store_view?.visibility = View.GONE
              }
  
              if ((response.getError() as? UnknownHostException) != null) {
                  AuthManager.logout(this.activity)
                  NavigationManager.goToLogin(this.activity)
              }
          }
      }
  
      private fun search(searchView: SearchView) {
          searchView.setOnQueryTextListener(object : SearchView.OnQueryTextListener {
              override fun onQueryTextSubmit(query: String?): Boolean {
                  return false
              }
  
              override fun onQueryTextChange(newText: String?): Boolean {
                  adapter.filter.filter(newText)
  
                  return true
              }
  
          })
      }
  }
  </code></pre>