Skip to main content
added 98 characters in body
Source Link
CodeRanger
  • 370
  • 3
  • 13

To make it short you could use "companion object" to get into Kotlin static world like :

  companion object {
    const val TAG = "tHomeFragment"
    fun newInstance() = HomeFragment()
}

and to make a constant field use "const val" as in the code. but try to avoid the static classes as it is making difficulties in unit testing using Mockito!.

To make it short you could use "companion object" to get into Kotlin static world like :

  companion object {
    const val TAG = "tHomeFragment"
    fun newInstance() = HomeFragment()
}

and to make a constant field use "const val" as in the code

To make it short you could use "companion object" to get into Kotlin static world like :

  companion object {
    const val TAG = "tHomeFragment"
    fun newInstance() = HomeFragment()
}

and to make a constant field use "const val" as in the code. but try to avoid the static classes as it is making difficulties in unit testing using Mockito!.

Source Link
CodeRanger
  • 370
  • 3
  • 13

To make it short you could use "companion object" to get into Kotlin static world like :

  companion object {
    const val TAG = "tHomeFragment"
    fun newInstance() = HomeFragment()
}

and to make a constant field use "const val" as in the code