+ 1
Fragment android beginner question
this is a code i found in a book.the code is trying to communicate between fragments with the help of the mainActivity. "this.listener = (WorkoutListListener) activity;" 1)why in the onAttach method we have to cast the interface to the activity? 2)why is it equals to this.listener(instance of WorkoutListListener) https://code.sololearn.com/cLhdwaVOm9vf/?ref=app
1 Respuesta
0
actually here it is used for getting the context of this class and used for initialization purpose so that it does not give null pointer exception