title: How to fix this bug using Kotlin,could not find Fragment constructor?
body: <p>I am developing <code>Android</code> app using Kotlin.In my app contains <code>Tab</code> with <code>ViewPager</code> so i implement the two tabs.when i move to another activity and compack to tab view activity the app getting fource stop and the <code>logcat</code> shows below the error.</p>
  
  <blockquote>
    <p>java.lang.RuntimeException: Unable to start activity ComponentInfo{com.crypto.wallet/com.crypto.wallet.activities.MainActivity}: android.support.v4.app.Fragment$InstantiationException: Unable to instantiate fragment com.crypto.wallet.activities.ReceiveFragment: could not find Fragment constructor</p>
  </blockquote>
  
  <p><strong>MyFragment.kt</strong></p>
  
  <pre><code>@SuppressLint("ValidFragment")
  class ReceiveFragment(private val transactionList: List&lt;TransactionEntity&gt;, val appDatabase: AppDatabase, private val direction: TransactionAdapterDirection,
                        val networkDefinitionProvider: NetworkDefinitionProvider) : Fragment(){
  
      private var linearLayoutManager: LinearLayoutManager? = null
  
      override fun onCreate(savedInstanceState: Bundle?) {
          super.onCreate(savedInstanceState)
  
      }
  
      override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
  
          val rootView = inflater.inflate(R.layout.receive_fragment, container, false)
          val recyclerView = rootView.findViewById&lt;RecyclerView&gt;(R.id.transaction_recycler_in) as RecyclerView
          linearLayoutManager = LinearLayoutManager(getActivity(), LinearLayout.VERTICAL, false)
          recyclerView.layoutManager = linearLayoutManager
          recyclerView.adapter = TransactionRecyclerAdapter(transactionList,appDatabase,direction,networkDefinitionProvider)
          recyclerView.setHasFixedSize(true);
          return rootView
      }
  }
  </code></pre>
  
  <p><strong>ViewPager.kt</strong></p>
  
  <pre><code>override fun getItem(position: Int): Fragment? {
          var fragment: Fragment? = null
          when (position) {
              //0 -&gt; fragment = ReceiveFragment(MytransactionList,MyappDatabase,Myincoming,MynetworkDefinitionProvider)
              0 -&gt; fragment = ReceiveFragment(MyIT,MyAppDatabase,MyIncoming,MyNetwork)
              1 -&gt; fragment = SendFragment()
          }
  
          return fragment
      }
  </code></pre>
  
  <p><strong>Main.kt
  OnCreate()</strong></p>
  
  <pre><code>val viewPager = findViewById&lt;ViewPager&gt;(R.id.viewpager)
                  if (viewPager != null) {
                      val adapter = ViewPagerAdapter(supportFragmentManager,it,appDatabase,INCOMING,networkDefinitionProvider)
                      viewPager.adapter = adapter
                  }
  
   val pref = applicationContext.getSharedPreferences("MyPref", 0) // 0 - for private mode
                  val editor = pref.edit()
                  val gson = Gson()
                  val json = gson.toJson(it)
                  editor.putString("MyObject", json)
                  editor.apply()
  </code></pre>
  
  <p><strong>OnResume()</strong></p>
  
  <pre><code>val prefs = applicationContext.getSharedPreferences("MyPref", 0)
          val gson = Gson()
          val json = prefs.getString("MyObject", "")
          val person1: List&lt;TransactionEntity&gt; = gson.fromJson(json, ArrayList&lt;TransactionEntity&gt;()::class.java)
  </code></pre>
  
  <p><strong>UPDATE:</strong> 
  After i tried this i get same error(i tried both Bundle and Shared pref):</p>
  
  <pre><code>companion object {
          @JvmStatic
          fun newInstance(myIT: List&lt;TransactionEntity&gt;, myAppDatabase: AppDatabase, myIncoming: TransactionAdapterDirection,
                          myNetwork: NetworkDefinitionProvider,
                          bundle: Bundle) =
                  ReceiveFragment(myIT, myAppDatabase, myIncoming, myNetwork,bundle).apply {
                      arguments = Bundle().apply {
                         /* val prefs = getActivity()!!.getApplicationContext().getSharedPreferences("myPrefs", 0)
                          val gson = Gson()
                          val json = prefs.getString("MyObject", "")
                          val person1: List&lt;TransactionEntity&gt; = gson.fromJson(json,
                                  ArrayList&lt;TransactionEntity&gt;()::class.java)
                          Log.d("Karthi", "Frag-GSON " + person1)*/
  
                          val dd = bundle.getSerializable("MySerializable")
                          Log.d("Karthi", "Frag-GSON " + dd)
                      }
                  }
      }
  </code></pre>
  
  <p>Main.kt:</p>
  
  <pre><code>val bundle = Bundle()
                  val gson_budle = Gson()
                  val json_bundle = gson_budle.toJson(it)
                  bundle.putSerializable("MySerializable", json_bundle)
  
                  val sharedPreferences = getSharedPreferences(myPreferences, Context.MODE_PRIVATE)
                  val editor = sharedPreferences.edit()
                  val gson = Gson()
                  val json = gson.toJson(it)
                  editor.putString("MyObject", json)
                  editor.putString("MyObject_json_bundle", json_bundle)
                  Log.d("Karthi","After - IT" + json)
                  Log.d("Karthi","After - IT" + json_bundle)
                  editor.apply()
  </code></pre>
  
  <blockquote>
    <p>FATAL EXCEPTION: main
                                                                       Process: com.crypto.wallet, PID: 29313
                                                                       java.lang.RuntimeException: Unable to start activity ComponentInfo{com.crypto.wallet/com.crypto.wallet.activities.MainActivity}: android.support.v4.app.Fragment$InstantiationException: Unable to instantiate fragment com.crypto.wallet.activities.ReceiveFragment: could not find Fragment constructor
    at android.support.v4.app.FragmentController.restoreAllState(FragmentController.java:152)
                                                                           at android.support.v4.app.FragmentActivity.onCreate(FragmentActivity.java:330)
                                                                           at android.support.v7.app.AppCompatActivity.onCreate(AppCompatActivity.java:84)
                                                                           at com.crypto.wallet.activities.MainActivity.onCreate(MainActivity.kt:194)</p>
  </blockquote>