Java tutorial
//package com.java2s; import android.widget.TextView; public class Main { public static String getViewText(TextView view) { if (view == null) { return "0"; } boolean empty = android.text.TextUtils.isEmpty(view.getText().toString()); return empty ? "0" : view.getText().toString(); } }