Log java.lang.String cannot be cast to Model Story

i’m new here so can anyone help the log keep saying that the String cannot cast to Story model but when i change the List to String
i can’t get the story.getUserId()

class StoryAdapter(private val mContext: Context, private val mStory: List)
:RecyclerView.Adapter<StoryAdapter.ViewHolder>()

{

override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {

    return if (viewType == 0)
    {
        val view = LayoutInflater.from(mContext).inflate(R.layout.add_story_item, parent, false)
        ViewHolder(view)
    }
    else
    {
        val view = LayoutInflater.from(mContext).inflate(R.layout.story_item, parent, false)
        ViewHolder(view)
    }

}

override fun getItemCount(): Int {
    return mStory.size
}

override fun onBindViewHolder(holder: ViewHolder, position: Int) {

the log keep showing that problem is here in val story = mStory[position]

    val story = mStory[position]

    userInfo(holder, story.getUserId(), position)

    holder.itemView.setOnClickListener {
        val intent = Intent(mContext, AddStoryActivity::class.java)
        intent.putExtra("userid", story.getUserId())
        mContext.startActivity(intent)
    }
}

log
java.lang.String cannot be cast to com.example.instagramcloneapp.Model.Story
at com.example.instagramcloneapp.Adapter.StoryAdapter.onBindViewHolder(StoryAdapter.kt:56)
at com.example.instagramcloneapp.Adapter.StoryAdapter.onBindViewHolder(StoryAdapter.kt:29)

Hi, Salman.

I haven’t seen here the error related to the Backendless. it is more related to Android API and kotlin. And for such cases more special resources exists.

If you think the error relates to backendless, could you please provide code snippet with the backendless api where the error happens. It will help as to reproduce it on our side.