Issue
I'm trying to do a putExtra in a ViewModel but I get this error:
None of the following functions can be called with the arguments supplied.
This is my code:
val intent = Intent(context, MyService::class.java)
intent.action = MyService.ACTION_ONE
intent.putExtra("data", mydata)
ContextCompat.startForegroundService(context, intent)
Why I can't do putExtra?
Solution
You cannot pass LiveData<Int> in an Intent extra. You could pass the current Int value (mydata.value) as an Intent extra, if you wanted.
Answered By - CommonsWare
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.