Used Navigation Drawer Activity (created using the environment of Android Studio). Added RecyclerView with cards (CardView) to the main screen. I can not open a new frame by clicking on the card.
Library: import android.support.v7.app.AppCompatActivity;
fragment class code:
import android.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; public class AdvertDetails extends Fragment { ... } Adapter code RecyclerViewAdapter:
public void onBindViewHolder(final MyViewHolder holder, int position) { AdvertItem album = albumList.get(position); holder.title.setText(album.title); holder.count.setText(album.price + " рублей"); // loading album cover using Glide library Glide.with(mContext).load(album.thumbnail).into(holder.thumbnail); holder.cardView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Fragment fragment = null; fragment = new AdvertDetails(); FragmentManager manager = ((Activity) mContext).getFragmentManager(); manager.beginTransaction() .replace(R.id.container, fragment) .commit(); } }); } Java.lang.IllegalArgumentException error: No view found for id 0x7f080033 (programs: id / container) for fragment AdvertDetails {31fef6 # 1 id = 0x7f080033}