Posts

Showing posts from October, 2017

OnFragmentInteractionListener Implemented On Parent Fragment

If you're a Android Developer  OnFragmentInteractionListener Interface is not a new thing for you. It is the callback interface that comes with the auto-generated code, when you add a new fragment to your project in Android Studio. If you have some exposure, you already know that it is used to pass messages to Activity from within the Fragment Code. Even if you don't have any experience in android it's not something hard to understand. It is a pattern we always use in OOP languages for callbacks. You can know about it thoroughly, by reading my post,  Callbacks With Interfaces Or Delegates . Read the Java part there. Anyway in simple word, it's one class calling an interface method, and the other class is forced to implement that interface at creation. In most of the scenarios, this can be achieved by forcing to pass an interface implemented class through the constructor at creation. But as android works on a life cycle approach, the interface implemented class o