Java tutorial
//package com.java2s; import android.util.Log; public class Main { private static final String TAG = "WareNinjaUtils"; public static Float stringToFloat(String str) { if (str == null) { return null; } else { try { return Float.parseFloat(str); } catch (NumberFormatException e) { Log.w(TAG, "Unable to interpret value " + str + " in field being " + "converted to float, caught NumberFormatException <" + e.getMessage() + "> field discarded"); return null; } } } }