Android Kotlin:无法覆盖?

Android Kotlin:无法覆盖?,android,android-volley,Android,Android Volley,我想发一篇关于截击的HTTP帖子。根据IDE,我无法覆盖getBodyContentType和getBody方法,无论网络上的一些示例是否显示了这一点。大括号中的语法是什么?我做错了什么 错误消息:修饰符“覆盖”不适用于“本地” 函数' 同样可以在Kotlin中使用 同样可以在Kotlin中使用 val textView = findViewById<TextView>(R.id.loginStatus) val queue = Volley.newRequestQueue(thi

我想发一篇关于截击的HTTP帖子。根据IDE,我无法覆盖getBodyContentType和getBody方法,无论网络上的一些示例是否显示了这一点。大括号中的语法是什么?我做错了什么

错误消息:修饰符“覆盖”不适用于“本地” 函数'


同样可以在Kotlin中使用


同样可以在Kotlin中使用

val textView = findViewById<TextView>(R.id.loginStatus)

val queue = Volley.newRequestQueue(this)
val url = "http://example.com/v1/user/read"


val stringRequest = StringRequest( Request.Method.GET, url,
    Response.Listener<String> { response ->
        textView.text = "Response is here"
    },
    Response.ErrorListener { textView.text = "Error." }

){
    override fun getBodyContentType(): String {
        return "application/json"
    }

    override fun getBody(): ByteArray {
        return "{\"email\":\"123@foo.de\", \"passwort\":\"123\"}".toString().toByteArray()
    }
}
val stringRequest = object : StringRequest(...){ 

    override fun getBodyContentType(): String {
    ...
    }

    override fun getBody(): ByteArray {
    ...
    }

}