Local Broadcast not updating UI


i have this code in my register user activity:
val userDataChange = Intent(BROADCAST_USER_DATA_CHANGE)
userDataChange.putExtra(“aaa”, “aaaaaaaa”)
userDataChange.putExtra(“bbb”, 123)

and in the main activity the reciever:

and the userDatachangeReceiver function:
private val userDataChangeReceiver = object: BroadcastReceiver() {
override fun onReceive(context: Context?, intent: Intent?) {
Log.d(“aaa”, AuthService.isLoggedIn.toString())
userNameNavHeader.text = "BBBBBBBBBBB"
if (AuthService.isLoggedIn == true) {
userNameNavHeader.text = userDataService.name
userEmailNavHeader.text = userDataService.email
val resourceId = resources.getIdentifier(userDataService.avatarName, “drawable”,

loginButtonNavHeader.text = “Logout”

the create user activity updates the userDataService(singelton) just fine,
when i log it i get the right parameters. the AuthService.isLoggedIn returns true but the drawer UI does not gets updated i have tryed to put it int the onStart, onResume unregister on onPause but no luck, also when i try to access the bundle inside the intent i get null. i put it there just to see if its really getting thrugh any ideas?

after i added these lines in the onCreate of MainActivity:
userNameNavHeader.text = "name"
userEmailNavHeader.text = "email"
and now the update goes well, can anyone help me understand why?


This seems to be a question on Android programming in general; please ask it on StackOverflow instead.