Android Toast Create formatToastDist(String message, int value, String unit)

Here you can find the source of formatToastDist(String message, int value, String unit)

Description

format Toast Dist

Declaration

public static String formatToastDist(String message, int value,
            String unit) 

Method Source Code

//package com.java2s;

public class Main {
    public static String formatToastDist(String message, int value,
            String unit) {//from w w  w. j a  v a 2s .  c  o m
        if (unit.equals("km"))
            message += ": " + value + " km";
        else
            message += ": " + KmToMiles(value) + " miles";

        return message;
    }

    public static int KmToMiles(int distance) {

        double dist = distance * 0.621;
        return (int) dist;
    }
}

Related

  1. showToastLong(Activity ctx, String text)
  2. showMessage(Context ctx, String msg)
  3. showMessage(final Activity context, final String message)
  4. showFailure(Activity activity, int id)
  5. showElapsed(long start, long end, Context ctx)
  6. formatToastTemp(String message, int value, String unit)
  7. showMessage(final Activity activity, final String message)
  8. showToast(Activity activity, String message)
  9. showToast(final Activity ctx, final String text, final int position, final boolean alive)