Java tutorial
//package com.java2s; import android.widget.TextView; public class Main { public static String getNumTVAsString(TextView tv) { if (isTVEmpty(tv)) { return "0"; } else { return tv.getText().toString(); } } public static boolean isTVEmpty(TextView tv) { return tv.getText().toString().trim().length() == 0; } }