You can't, in Java classes can't inherit from two classes at the same time. Only one. Considering your adapter already extends RecyclerView.Adapter
then you can't.
The recommended approach is to use callback. A callback is an interface
that is implements
on the host activity or fragment and pass as an argument to the other class (the adapter on this case). Your adapter will hold a reference to the callback, so when the view is clicked then the reference will be called triggering the implementation on the activity or fragment.
You can see a detailed explanation here
- When the click happens, from the activity start the intent to the camera
- After the photo is taken inside
onActivityResult
on the activity pass the result to the adapter
- The adapter need a method for receiving the result, it should be something like this
public void addPhoto(SomeObject object){
yourData.add(object);
notifyDataseChanged();
}
- The code inside
onActivityResult
should be something like this
SomeObject objet = data... //you have to get the data and transform it to your format
adaper.addPhoto(object)