Skip to content

Instantly share code, notes, and snippets.

@hakoerber
Created September 25, 2013 16:53
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save hakoerber/6702563 to your computer and use it in GitHub Desktop.
public void onClickBerufsschule(int Feierabend, int Start, int stunden,
int minuten) {
double rest = (double)((Feierabend - ((stunden - Start) + minuten)));
double restprozent = (double)(((rest /Feierabend) * 100.0));
if (restprozent > 100.0 || restprozent < 0.0) {
Toast.makeText(this, "Fehler! Überprüfe bitte deine Eingaben.",
Toast.LENGTH_LONG).show();
} else {
seekBar.setProgress(100 - ((int) restprozent));
DecimalFormat f = new DecimalFormat("#0.00");
Toast.makeText(
this,
"Du hast noch " + f.format(restprozent)
+ "% bis Feierabend!", Toast.LENGTH_LONG).show();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment