Answer the question
In order to leave comments, you need to log in
How to assign target fragment not in fragment class?
I have an adapter for an ExpandableList, it makes a listView on a TaskList fragment, and in the adapter, when the child is clicked, a new TaskDialog fragment opens.
I need to target a TaskList for a TaskDialog!
If this is done in the fragment class, then there are no problems, but when I do it in the adapter class, an error occurs!
TaskDialog taskDialog = TaskDialog.newInstance(name);
taskDialog.setTargetFragment(TaskList.class, REQUEST_ADD_TASK_CODE);
taskDialog.show(context.getSupportFragmentManager(), TASK_DIALOG_FLAG);
Answer the question
In order to leave comments, you need to log in
setTargetFragment() takes an instance of the Fragment class as input, and you push the class to it. Of course, this cannot be done, you need to transfer a specific object. From what class it will be made (from a fragment, adapter, etc.) - all the same.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question