I'm creating the login page for my application and it gives me the error of Cannot infer a type of this parameter. Please specify it explicitly
.
It gives error only within error and response. Any clue why it is like that?
var rq: RequestQueue = Volley.newRequestQueue(this)
var sr = StringRequest(Request.Method.GET, url, Response.Listener { response ->
if(response.equals("0"))
Toast.makeText(this, "Login failed.", Toast.LENGTH_LONG).show()
else
var i = Intent(this,LoggedinActivity::class.java)
startActivity(i)
Toast.makeText(this, "User created successfully.", Toast.LENGTH_LONG).show()
}, Response.ErrorListener {
error ->
Toast.makeText(this, error.message, Toast.LENGTH_LONG).show()
})
rq.add(sr)
The problem has been arised because I didn't check all the brackets correctly, thus if statements didn't work correctly and it was giving error because of that.
Sorry for the inconvenience. I wish you great week ahead. I checked the first answer as correct one.