Skip to content

Instantly share code, notes, and snippets.

View nikolajakshic's full-sized avatar

Nikola Jakšić nikolajakshic

View GitHub Profile
java.lang.ClassCastException: com.google.gson.internal.LinkedTreeMap cannot be cast to Item
at AppKt$module$2$1.doResume(app.kt:18)
at AppKt$module$2$1.invoke(app.kt)
at AppKt$module$2$1.invoke(app.kt)
at io.ktor.pipeline.PipelineContext.proceed(PipelineContext.kt:49)
at io.ktor.pipeline.Pipeline.execute(Pipeline.kt:22)
at io.ktor.routing.Routing.executeResult(Routing.kt:100)
at io.ktor.routing.Routing.interceptor(Routing.kt:25)
at io.ktor.routing.Routing$Feature$install$1.doResume(Routing.kt:66)
at io.ktor.routing.Routing$Feature$install$1.invoke(Routing.kt)
import io.ktor.application.Application
import io.ktor.application.call
import io.ktor.application.install
import io.ktor.features.ContentNegotiation
import io.ktor.gson.gson
import io.ktor.request.receive
import io.ktor.routing.post
import io.ktor.routing.routing
fun Application.module() {
<LinearLayout
android:orientation="vertical">
<View
android:background="#D3D3D3"
android:id="@+id/item_divider" />
<TextView
android:id="@+id/item_title"
tools:text="Léon: The Professional" />
<LinearLayout
android:id="@+id/sub_item"
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
movieList = setupList();
RecAdapter adapter = new RecAdapter(movieList);
RecyclerView recyclerView = findViewById(R.id.recview);
@Override
public void onBindViewHolder(RecViewHolder holder, int position) {
Movie movie = list.get(position);
// Set movie data
holder.bind(movie);
holder.itemView.setOnClickListener(v -> {
// Get the current state of the item
boolean expanded = movie.isExpanded();
// Change the state
public class Movie {
private String title;
private String genre;
private int year;
// State of the item
private boolean expanded;
public Movie(String title, String genre, int year) {
this.title = title;