I got the error notification like this:
how to resolve?
I found the correct code:
fun newIntent(packageContext: android.content.Context, answerIsTrue:Boolean):Intent{
return Intent(packageContext,CheatActivity::class.java).apply {
putExtra(EXTRA_ANSWER_IS_TRUE,answerIsTrue)
}
}
I don’t know why and since when it needs to be expressed like this. But it works. Hoop!!
I found the rootcause.
In my , the IDE automatically added the following import:
import org.junit.runner.manipulation.Ordering.Context
If I just write context
, it will be identified as context of org.junit.runner.manipulation.Ordering.Context
which is not a valid argument type for Intent constructor.
I tried to remember why this package is imported and found why.
When first time I typed Context, the prompt options should be selected Context(android.content)
, but maybe I choosed Context(org.junit.runner.manipulation.Ordering)
I started from fresh, now it works!! Hoop~~~
the Import packages are also correct: