Retrofit interface:
@GET("api")
fun fetchTests(): Call<ArrayList<Test>>
Activity code:
class HomeActivity : AppCompatActivity(), Callback<ArrayList<Test>> {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_home)
fetchTests()
}
private fun fetchTests() {
val api = Api.getApiService()
val call = api.fetchTests()
call.enqueue(this)
}}
I can't pass the callback using this, it is passing the HomeActivity instance instead. However if i try to used Void or Any as the type of Call and Callback it works fine.
What could be the reason for this behavior?
Here is the Test class
data class Test(val name: String, val id: Int)
Additional Details:
I tried to do the inline callback method and this is the error message I got

Update: I don't know why I got downvoted for a genuine question this was clearly a problem with Android studio. Getting reputation points here is difficult downvoters should know that.