Suppose i have a timer which uses a TextView
in Fragment A. And i want to use this timer in Fragment B. How would i do it? This is the code which is being used in Fragment A to set the timer...
private Runnable mUpdateTimeTask = new Runnable() {
public void run() {
long totalDuration = mp.getDuration();
long currentDuration = mp.getCurrentPosition();
// Displaying total duration time
songTotalDurationLabel.setText(""+utils.milliSecondsToTimer(totalDuration));
// Displaying current time
songCurrentDurationLabel.setText(""+utils.milliSecondsToTimer(currentDuration));
// Running this thread after 100 milliseconds
mHandler.postDelayed(this, 100);
}
};
Now i want to use the timer that's associated with the songCurrentDurationLabel
TextView, in Fragment B as well.
How would i go about solving this?
Thanks!