var wall= ArrayList<VKWall>()
try {
val response = r.getString("response") as String
val moshi = Moshi.Builder().build()
val type: Type = Types.newParameterizedType(
ArrayList::class.java,
VKWall::class.java
)
val jsonAdapter: JsonAdapter<ArrayList<VKWall>> = moshi.adapter(type)
wall = jsonAdapter.fromJson(response)!!
} catch (e: JSONException){}
return wall
It can not create adapter. Debuger can`t execute this string and goes to exception of function over this code
val jsonAdapter: JsonAdapter<ArrayList<VKWall>> = moshi.adapter(type)
I`am trying to do everything like there https://github.com/square/moshi
Platform java.util.ArrayList<com.e.app.fragments.vk_tabs.WallFragment.DataPackage.VKWall> (with no annotations) requires explicit JsonAdapter to be registered
@Parcelize
@JsonClass(
generateAdapter = true)
data class VKWall (
// val UserName:String="",
// val UserSurname:String="",
@Json(name = "text")
val Text:String="" ,
// val attachments: Attachments?,
// val copyright: String="",
// val repost: Repost?
):Parcelable
{
}