vendredi 5 août 2016

how onAttach() gets to know which activity is calling it (android studio)

@Override public void onAttach(Activity activity) { super.onAttach(activity); try{ activityCommander = (TopSectionListener) activity; }catch (ClassCastException e){ throw new ClassCastException(activity.toString()); } }

i want to know how an activity calls onAttach of fragment , so that fragment comes to know by which activity it is called or attached to ?

Aucun commentaire:

Enregistrer un commentaire