Android examples for User Interface:ProgressDialog
Function to change progress to timer for ProgressDialog
//package com.java2s; public class Main { /**//from w ww.j ava 2s . com * Function to change progress to timer * * @param progress the percentage of the progress bar * @param totalDuration the total duration of the track * @return current duration in milliseconds */ public static int progressToTimer(int progress, int totalDuration) { if (progress == 0) { return 0; } int currentDuration = 0; totalDuration = (int) (totalDuration / 1000); currentDuration = (int) ((((double) progress) / 100) * totalDuration); // return current duration in milliseconds return currentDuration * 1000; } }