Добавить
Уведомления

How to notify other fragments of any change | View-pager With Tabbed-Layout | Android

I have made an application with Tabbed-Layout and View-pager. The view-pager consists of two fragments. The problem here is that the two fragments cannot communicate with each other directly, so they need a medium to connect to each other or specifically to send msg or even large amount of data to each other. For this I have implemented two Interfaces. The SectionPagerAdapter class implements from the IAdapter whose reference is given to all the fragments so that when any change is made to that fragment and it wanted to notify the other fragments it can use the reference to call 'onSend' method of IAdapter. The SectionAdapterClass gets notified of the change and also notifies all the other fragments in the view-pager. The fragment may, however, choose not to be obliged to notify the IAdapter, probably because it doesn't perform any function which needs attention. The fragment classes Implements ITabbedFragment and receives the data if any other fragment notified the IAdapter to send it. - Connect on Fiverr: https://www.fiverr.com/khurrammemon37 - Fiverr Gig Link https://www.fiverr.com/khurrammemon37/help-with-your-android-project - GitHub Link (Source Code) https://github.com/Nomemmurrakh/YTTransferData

Иконка канала Андроид-фильмы
2 подписчика
12+
12 просмотров
Год назад
24 октября 2024 г.
12+
12 просмотров
Год назад
24 октября 2024 г.

I have made an application with Tabbed-Layout and View-pager. The view-pager consists of two fragments. The problem here is that the two fragments cannot communicate with each other directly, so they need a medium to connect to each other or specifically to send msg or even large amount of data to each other. For this I have implemented two Interfaces. The SectionPagerAdapter class implements from the IAdapter whose reference is given to all the fragments so that when any change is made to that fragment and it wanted to notify the other fragments it can use the reference to call 'onSend' method of IAdapter. The SectionAdapterClass gets notified of the change and also notifies all the other fragments in the view-pager. The fragment may, however, choose not to be obliged to notify the IAdapter, probably because it doesn't perform any function which needs attention. The fragment classes Implements ITabbedFragment and receives the data if any other fragment notified the IAdapter to send it. - Connect on Fiverr: https://www.fiverr.com/khurrammemon37 - Fiverr Gig Link https://www.fiverr.com/khurrammemon37/help-with-your-android-project - GitHub Link (Source Code) https://github.com/Nomemmurrakh/YTTransferData

, чтобы оставлять комментарии