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); } } }
TextView? - BarmaleyRecyclerViewAdapterclass in which I get links to theviewitems from the layout thatRecyclerViewAdapteruses, then in theonBindViewHoldermethod I set the text for these links. And this is no problem, but I want myMediaPlayerlayout that uses theRecyclerViewAdapteraccordingly, with all the requirements arising from it. Now add the adapter code. - McDaggenMediaPlayerclass is used to control the playback of audio / video files and streams. How do you want to place it in the layout of theRecyclerViewitem? And most importantly for what? - eugeneek