Reputation: 4086
I'm trying to build an AccountAuthenticator
class with kotlin for android. But when trying to implement the AbstractAccountAuthenticator
class I get the following exception at compile:
No value passed for parameter context
I'm not entirely sure what it means and can't find anything on how to solve it.
Here is the relevant code:
import android.accounts.AbstractAccountAuthenticator
import android.accounts.Account
import android.accounts.AccountAuthenticatorResponse
import android.os.Bundle
class AccountAuthenticator: AbstractAccountAuthenticator() {}
Does anyone know what this means, why, and how to fix it?
Upvotes: 6
Views: 27354
Reputation: 89548
AbstractAccountAuthenticator
's constructor takes a Context context
parameter. So you'll have to pass a Context
to it somehow, for example, your AccountAuthenticator
could also have a Context
parameter:
class AccountAuthenticator(context: Context): AbstractAccountAuthenticator(context) {}
Upvotes: 13
Reputation: 1599
I don't know much about Kotlin but AbstractAccountAuthenticator
constructor takes a Context
see here.
So I guess you have to implement this constructor and other related abstract methods.
Upvotes: 1