Skip to content

Instantly share code, notes, and snippets.

@iraSenthil
Created June 13, 2013 15:56
Show Gist options
  • Select an option

  • Save iraSenthil/5774870 to your computer and use it in GitHub Desktop.

Select an option

Save iraSenthil/5774870 to your computer and use it in GitHub Desktop.
private void resetUi(){
runOnUiThread(new Runnable() {
@Override
public void run() {
button.setVisibility(View.VISIBLE);
webView.setVisibility(View.GONE);
}
});
}
private void displayTotalWalkingDistance(double totalWalkingDistanceMiles) {
final String milesWalkedMessage = (totalWalkingDistanceMiles < 1) ? "0 miles?, You get no respect, Start walking already!!!" :
String.format("Cool, You have walked %.2f miles so far.", totalWalkingDistanceMiles);
displayToast(milesWalkedMessage);
resetUi();
}
private void displayToast(final String message) {
runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(getApplicationContext(), message, Toast.LENGTH_LONG).show();
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment