How to solve Unresolved Reference:java - kotlin

Handler(Looper.getMainLooper()).postDelayed({
startActivity(Intent(this#SplashScreenActivity, MainActivity::class.java))
finish()
},3000)
}
At MainActivity::class.java get the error message = "Unresolved References" , How to solve the problem?

Related

Unresolved reference: textField

I get this message "Unresolved reference: textField" on the start of the third line on this block of code:
val items = listOf("Material", "Design", "Components", "Android")
val adapter = ArrayAdapter(requireContext(), R.layout.list_item, items)
(textField.editText as? AutoCompleteTextView)?.setAdapter(adapter)
I just copied and pasted the code directly from the material design documentation site following their instructions, but I doesn't seems to work. What am I missing here?

Safaricaom Daraja API Android initialization failure (DarajaListener<AccessToken!>! was expected)

This is the way to initialize the Daraja API in Kotlin. Problem is, I get a type mismatch on the forth parameter of Dajara.with(1st, 2nd, 3rd, 4th) function. The error is at the object : DarajaListener parameter.
daraja = Daraja.with("CONSUME_KEY", "CONSUMER_SECRET_KEY", Env.SANDBOX,
**object : DarajaListener<AccessToken>** {
override fun onResult(result: AccessToken) {
Toast.makeText(applicationContext, result.access_token, Toast.LENGTH_SHORT).show()
}
override fun onError(error: String?) {
Toast.makeText(applicationContext, error.toString(), Toast.LENGTH_SHORT).show()
}
})
The build error is as follows:
Type mismatch: inferred type is but DarajaListener<AccessToken!>! was expected
Hovering the cursor around the error flashes this message:
Type mismatch.
Required:DarajaListener<AccessToken!>!Found:
Any help initializing it the right way?
It was a simple matter of imports. I had imported the wrong AccessToken. Instead of the one from the Daraja api, I imported the one provided by Facebook. Can't believe this costed me a week!

IntelliJ gives error about reference in Kotlin

I'm trying to go though the Kotlin tutorial from Freecode camp, but have this issue with references.
IntelliJ complained that
Unresolved reference: greeting in sayHello() in main()
Unexpected
tokens (use ';' to separate expressions on the same line), after
"Hi"
fun sayHello(greeting:String, vararg itemsToGreet: String) {
itemsToGreet.forEach { itemToGreet ->
println("$greeting $itemToGreet")
}
}
fun main() {
val interestingThings = listOf("Kotlin", "Programming", "Comic Books")
sayHello(greeting:"Hi", itemsToGreet:"Kotlin", "Programming", "Comic Books")
}
It seems that assigning values to params can be done only by "=", not ":"
"greeting:" is a parameter name hint. Code should look like this:
sayHello("Hi", "Kotlin", "Programming", "Comic Books")
See how hints will be shown automatically.

How to list `cannot resolve symbol` warnings in groovy code? (IntelliJ)

I want to list all cannot resolve symbol warnings in my groovy code. I set severity level of Groovy->Probable bugs->Access to unresolved expression in my inspection profile to Warning. IntelliJ does highlight the cannot resolve symbol warnings in edit view but it does not list the problems in the list of problems after I run Analyze->Inspect Code....
I'm using IntelliJ IDEA 15.0.2.
Running inspection on the following piece of groovy code responds with a message No suspicious code found though fooo() is highlighted.
class Example {
def foo() {
fooo() // highlighted as `Cannot resolve symbol 'fooo'`
}
}
You are looking for static compilation behavior. Please use #CompileStatic for it
import groovy.transform.CompileStatic
#CompileStatic
class Example {
def foo() {
fooo() // highlighted as `Cannot resolve symbol 'fooo'`: shows as error in IJ14
}
}

MonoRail - "Unexpected item on the stack" Error

Anyone seen this MonoRail error before and know what it means?
Unexpected item on the stack: found UCampus.Core.Models.Nested.Hours, expecting UCampus.Core.Models.Business
I'm saving a Business object when this error occurs, Hours is a child of a child of Business.
Thanks,
Justin
In the Hours class it for some reason was overriding the GetHashCode method and that was causing this peculiar exception. Any idea why they would've been overriding GetHashCode??
//public override int GetHashCode()
//{
// unchecked
// {
// return (GetHours(Open) * 397) ^ GetHours(Close);
// }
//}