Android Kotlin - Unexpected tokens (use ';' to separate expressions on the same line)

Pikaboo :

I found couple of answers for this but I don't understand what the hell they are talking about and what to do in my case.

This is the code:

Functions().(prefs!!.getLong("userid", 0), prefs!!.getString("notifToken", "")!!)

I get Unexpected tokens (use ';' to separate expressions on the same line) for prefs!!.getString("notifToken", "")!!

And in Functions class:

fun lastOnline(userid: Long, token: String){

    val params = RequestParams()
    params.put("userid", userid)
    params.put("token", token)

    val client = AsyncHttpClient()
    client.post("https://www.bla.com/do.php", params, object : JsonHttpResponseHandler()
    {
        override fun onSuccess(statusCode: Int, headers: Array<Header>?, response: JSONArray?)
        {

        }
        override fun onFailure(statusCode: Int, headers: Array<Header>?, e: Throwable, response: JSONArray?)
        {
            Log.d("pikabo", "error")
        }
    })
}

Please help!

CommonsWare :

Your code boils down to Functions().(), and that does not make a lot of sense. Functions() will create an instance of your Functions class. But then you seem to be missing a function name after the ..

I am going to guess that you are trying to call lastOnline(), in which case you need to use that function name:

Functions().lastOnline(prefs!!.getLong("userid", 0), prefs!!.getString("notifToken", "")!!)

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Android Kotlin - Unexpected tokens (use ';' to separate expressions on the same line)

Unexpected tokens (use ';' to separate expressions on the same line) error in Kotlin

Unexpected tokens (use ';' to separate expressions on the same line)

Not work "include" in Kotlin script: ^ Unexpected tokens (use ';' to separate expressions on the same line)

Unexpected tokens (use ; to seperate expressions on the same line) in kotlin

Kotlin 2 Errors: error: unexpected tokens (use ';' to separate expressions on the same line) AND error: smart cast to 'Int' is impossible, because

Unexpected tokens (use ; to seperate expressions on the same line)

Unexpected tokens (use ';' to separate expressions on the same line) in build.gradle.kts

Unexpected tokens (use ';' to separate expressions on the same line) in build.gradle.kts when i add rxjava and rxkotlin

Kotlin Null safety warning Unexpected tokens (use ; to seperate expressions on the same line)

Beginner Android Studio: Unexpected Tokens?

Im not sure how to use strtok to separate tokens

take tokens from the same line in r programming

Android studio Kotlin put function call parameters on the same line

Separate positions for elements on the same "line"

How to use the kotlin compiler in command line which comes with Android Studio?

How to use both Kotlin Android Extensions and Databinding at the same time?

Separate alignment for 2 div elements on the same line

Using grep to match where two tokens occur on the same line

How to use back references in kotlin regular expressions?

Android System's use of Binder Tokens

Android Kotlin - Volley Unexpected response code 400

Split does not separate with tokens

Difference between storing an imageview in a variable and intializing it later, compared to doing it all on the same line(android studio kotlin)

Use two fold expressions in one line

Is multiple array initialization on the same line the same as on separate lines?

separate line in words by slash and use /W but avoid :

a better way to use Scanner for multiple tokens per line?

ArrayAdapter use Kotlin android