I have to implement an application for my university and I need some advice from an expert 🙂 . I have an activity that use PageIndicator, every page is a fragment. Max one page is currently displayed. In every fragment there are 4 widget that contains a value read from application via Bluetooth (there is a serial device that send data via Bluetooth to the application) I think that my activity must have a independent thread that in a loop communicate with the serial devices. But when this thread reads value, how can send the data to the current fragment, in particular to the specified widget? the current widget must show most recent data read. In other words i need to know how a thread of activity can send a dato to the current fragment .
sorry for my english
I have to implement an application for my university and I need some advice
Share
while creating the fragments, record them in an ArrayList and create a custom fragment class that extends Fragment
and inside the fragment create a method to receive the updates, for example
your fragment class:
then instead of “extends Fragment” use “extends CustomFragment”
then from other classes