Android examples for java.lang:String Parse
parse value to boolean
//package com.java2s; import android.text.TextUtils; public class Main { /**// ww w .j a va 2s . c om * parse value to boolean */ public static boolean toBoolean(Object value) { if (value instanceof Boolean) { return (Boolean) value; } return value == null ? false : toBoolean(String.valueOf(value)); } /** * parse value to boolean */ public static boolean toBoolean(String value) { return TextUtils.isEmpty(value) ? false : Boolean .parseBoolean(value); } }