HealthDataUnit
overview package class tree deprecated index com.samsung.android.sdk.healthdata class healthdataunit java.lang.object com.samsung.android.sdk.healthdata.healthdataunit public abstract class healthdataunit extends object this class represents a unified measurement unit and unit conversion. converting unit you can convert measured health data value to another unit easily with healthdataunit. the following example shows unit conversion with the predefined unit in the health data framework. public class healthdataunitexample { void convert() { double gram = healthdataunit.pound.convertto(1, healthdataunit.gram); // gram is 453.59237 } static double convert(double source, string sourceunit, string destunit) { return healthdataunit.valueof(sourceunit).convertto(source, destunit); } } since: 1.0.0 field summary fields modifier and type field and description static healthdataunit celsius "c" a temperature unit static healthdataunit centimeter "cm" a length unit static healthdataunit fahrenheit "f" a temperature unit static healthdataunit fluid_ounce "fl. oz." static healthdataunit foot "ft" a length unit static healthdataunit gram "g" a weight unit static healthdataunit grams_per_deciliter "g/dl" a substance concentration unit static healthdataunit hba1c_percent "%" a hba1c unit static healthdataunit inch "in" a length unit static healthdataunit kelvin "k" a temperature unit static healthdataunit kilogram "kg" a weight unit static healthdataunit kilometer "km" a length unit static healthdataunit kilopascal "kpa" a pressure unit static healthdataunit liter "l" a volume unit static healthdataunit meter "m" a length unit static healthdataunit micromoles_per_liter "umol/l" a substance concentration unit static healthdataunit mile "mi" a length unit static healthdataunit milligrams_per_deciliter "mg/dl" a substance concentration unit static healthdataunit milliliter "ml" a volume unit static healthdataunit millimeter "mm" a length unit static healthdataunit millimeter_of_mercury "mmhg" a pressure unit static healthdataunit millimoles_per_liter "mmol/l" a substance concentration unit static healthdataunit millimoles_per_mole "mmol/mol" a hba1c unit static healthdataunit pound "lb" a weight unit static healthdataunit rankine "r" a temperature unit static healthdataunit yard "yd" a length unit constructor summary constructors modifier constructor and description protected healthdataunit() creates a healthdataunit instance. method summary all methods static methods instance methods concrete methods deprecated methods modifier and type method and description static double convert(double source, string sourceunit, string destunit) converts a given value for the source unit name to the destination unit name. double convertto(double source, healthdataunit destunit) converts a given value from the current unit to the destination unit object. double convertto(double source, string destunit) converts a given value from the current unit to the destination unit name. string getunitname() gets the health data unit name. boolean iscompatible(healthdataunit unit) checks if the unit of this instance is compatible with a specified unit. static boolean iscompatible(string source, string dest) checks if unit conversion is available between a source and destination unit. static void registerdataunit(healthdataunit unitobject) deprecated. a custom data unit is not supported. static healthdataunit valueof(string unit) gets the health data unit object for a given unit. field detail celsius public static final healthdataunit celsius "c" a temperature unit since: 1.0.0 centimeter public static final healthdataunit centimeter "cm" a length unit since: 1.0.0 gram public static final healthdataunit gram "g" a weight unit since: 1.0.0 kelvin public static final healthdataunit kelvin "k" a temperature unit since: 1.0.0 kilogram public static final healthdataunit kilogram "kg" a weight unit since: 1.0.0 kilometer public static final healthdataunit kilometer "km" a length unit since: 1.0.0 meter public static final healthdataunit meter "m" a length unit since: 1.0.0 millimeter public static final healthdataunit millimeter "mm" a length unit since: 1.0.0 fahrenheit public static final healthdataunit fahrenheit "f" a temperature unit since: 1.0.0 foot public static final healthdataunit foot "ft" a length unit since: 1.0.0 inch public static final healthdataunit inch "in" a length unit since: 1.0.0 mile public static final healthdataunit mile "mi" a length unit since: 1.0.0 pound public static final healthdataunit pound "lb" a weight unit since: 1.0.0 rankine public static final healthdataunit rankine "r" a temperature unit since: 1.0.0 yard public static final healthdataunit yard "yd" a length unit since: 1.0.0 grams_per_deciliter public static final healthdataunit grams_per_deciliter "g/dl" a substance concentration unit since: 1.3.0 milligrams_per_deciliter public static final healthdataunit milligrams_per_deciliter "mg/dl" a substance concentration unit since: 1.3.0 millimoles_per_liter public static final healthdataunit millimoles_per_liter "mmol/l" a substance concentration unit since: 1.3.0 micromoles_per_liter public static final healthdataunit micromoles_per_liter "umol/l" a substance concentration unit since: 1.3.0 millimoles_per_mole public static final healthdataunit millimoles_per_mole "mmol/mol" a hba1c unit since: 1.3.0 hba1c_percent public static final healthdataunit hba1c_percent "%" a hba1c unit since: 1.3.0 millimeter_of_mercury public static final healthdataunit millimeter_of_mercury "mmhg" a pressure unit since: 1.3.0 kilopascal public static final healthdataunit kilopascal "kpa" a pressure unit since: 1.3.0 liter public static final healthdataunit liter "l" a volume unit since: 1.3.0 milliliter public static final healthdataunit milliliter "ml" a volume unit since: 1.3.0 fluid_ounce public static final healthdataunit fluid_ounce "fl. oz." a volume unit since: 1.3.0 constructor detail healthdataunit protected healthdataunit() creates a healthdataunit instance. since: 1.0.0 method detail getunitname public string getunitname() gets the health data unit name. returns: string the unit name since: 1.0.0 valueof public static healthdataunit valueof(string unit) gets the health data unit object for a given unit. parameters: unit - the unit name returns: the healthdataunit instance to be used for unit conversion throws: unknownformatconversionexception - if unit conversion is not available for the given unit string since: 1.0.0 iscompatible public boolean iscompatible(healthdataunit unit) checks if the unit of this instance is compatible with a specified unit. parameters: unit - the other unit returns: true if the unit is compatible, or false throws: illegalargumentexception - if the given unit is null since: 1.0.0 iscompatible public static boolean iscompatible(string source, string dest) checks if unit conversion is available between a source and destination unit. parameters: source - the source unit name dest - the destination unit name returns: true if unit conversion is available, or false since: 1.0.0 convertto public double convertto(double source, healthdataunit destunit) converts a given value from the current unit to the destination unit object. parameters: source - the value of the current unit destunit - the destination unit for conversion returns: the converted value for the destination unit throws: unknownformatconversionexception - if conversion is not available for the destination unit since: 1.0.0 convertto public final double convertto(double source, string destunit) converts a given value from the current unit to the destination unit name. parameters: source - the value for the current unit destunit - the destination unit name for conversion returns: the converted value for the destination unit throws: unknownformatconversionexception - if conversion is not available for the destination unit illegalargumentexception - if the given destunit is null or contains an empty string since: 1.0.0 convert public static double convert(double source, string sourceunit, string destunit) converts a given value for the source unit name to the destination unit name. parameters: source - the value for the sourceunit sourceunit - the source unit name destunit - the destination unit name for conversion returns: the converted value for the destination unit throws: unknownformatconversionexception - if conversion is not available for the destination unit since: 1.0.0 registerdataunit public static void registerdataunit(healthdataunit unitobject) deprecated. a custom data unit is not supported. registers the custom data unit defined newly. parameters: unitobject - the health data unit object to register throws: illegalargumentexception - if given unit is null or existed already since: 1.0.0