This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val bundle = Bundle() | |
bundle.putParcelable("user", getUserData()) | |
navController.navigate(R.id.action_loginFragment_to_homeFragment, bundle) | |
// ************************************************************************************ | |
//TODO YOU CAN CUSTOMIZE HERE FOR YOU | |
private fun getUserData() = User(etMail.text.toString(), "Cengiz", "TORU") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Parcelize | |
data class User(val email: String, val name: String, val surname: String) : Parcelable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lateinit var email: String | |
lateinit var userID: Int | |
lateinit var isActive: Boolean | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
email = arguments!!.getString("email")!! | |
userID = arguments!!.getInt("userId")!! | |
isActive = arguments!!.getBoolean("isActive")!! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//PASS DATA WITHOUT SAFE ARGS, PASS DATA BY SIMPLE BUNDLE | |
val bundle = Bundle() | |
bundle.putString("email", etMail.text.toString()) | |
bundle.putInt("userID", 123) | |
bundle.putBoolean("isActive",false) | |
// ... | |
navController.navigate(R.id.action_loginFragment_to_homeFragment, bundle) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lateinit var navController: NavController | |
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | |
super.onViewCreated(view, savedInstanceState) | |
navController = Navigation.findNavController(view) | |
btnSignup.setOnClickListener { | |
navController.navigate(R.id.action_loginFragment_to_signupFragment) | |
} |