I have two fragments in my android application
I had created a JNI library which will call C API (Reading CAN values.)
CAN_Init() JNI need to call only once.
Read_Pid() JNI API I implemented and it will return integer array of 16 values and it should be call for every 250ms.
In each fragment I have 8 textview, so totally 16.
So how I can call Read_Pid() such that, if I am in first fragment only 8 (index 0 to 7) values I need to display in textview and if I am in second fragment I need to display another 8 (index 9 to 15), but Read_Pid() should keep on running in background for every 250ms.
Please can you suggest me what method (Service/Thread/AsyncTask/BroadcastReciever or what ?) I need to use in this situation ?
Please can you share me the example source code for this type of application ?