I use RecyclerView to display the list, and in this list in the adapter layout, I want to implement MediaPlayer and various view elements, the problem is that all the links and the implementation method must occur in the adapter class, I get links to the TextView in ViewHolder but with MediaPlayer having problems.

Advise the literature or please give a link to the correct implementation method of MediaPLayer and everything else as in a regular class or fragment in RecyclerViewAdapter .

Addition

 class RecyclerVAdapter extends RecyclerView.Adapter<RecyclerVAdapter.ViewHolder> { private static List<Head> mHead; RecyclerVAdapter(List<Head> contentItem) { mHead = contentItem; } @Override public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View itemView = LayoutInflater.from(parent.getContext()).inflate( R.layout.contents, parent, false); return new ViewHolder(itemView); } @Override public void onBindViewHolder(ViewHolder viewHolder, final int position) { viewHolder.mDuaAR.setText(mHead.get(position).getHead()); } @Override public int getItemCount() { return mHead.size(); } static class ViewHolder extends RecyclerView.ViewHolder { TextView MyHead; ViewHolder(View itemView) { super(itemView); MyHead= (TextView) itemView.findViewById(R.id.head); } } } 
  • Did anyone understand anything? I personally do not. And here the media player, and here TextView ? - Barmaley
  • @Barmaley I have a ViewHolder class nested in my RecyclerViewAdapter class in which I get links to the view items from the layout that RecyclerViewAdapter uses, then in the onBindViewHolder method I set the text for these links. And this is no problem, but I want my MediaPlayer layout that uses the RecyclerViewAdapter accordingly, with all the requirements arising from it. Now add the adapter code. - McDaggen
  • 2
    The MediaPlayer class is used to control the playback of audio / video files and streams. How do you want to place it in the layout of the RecyclerView item? And most importantly for what? - eugeneek
  • @eugeneek, Yes, I remember, here's how to put and ask. In order for my scrollable list on each item to have a play button with a progress line. - McDaggen

0