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

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

Description

format Toast Temp

Declaration

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

Method Source Code

//package com.java2s;

public class Main {
    public static String formatToastTemp(String message, int value,
            String unit) {/*from   ww  w .j  a  va 2  s.c o m*/
        if (unit.equals("c"))
            message += ": " + value + "?C";
        else
            message += ":" + CelciusToFahrenheit(value) + "?F";

        return message;
    }

    public static int CelciusToFahrenheit(int temp) {

        double fahr = temp * 9 / 5 + 32;
        return (int) fahr;
    }
}

Related

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