Android examples for android.view:View
set Text to View
import android.app.Activity; import android.content.Context; import android.content.pm.ApplicationInfo; import android.content.pm.PackageManager; import android.content.pm.PackageManager; import android.graphics.Bitmap; import android.os.Bundle; import android.telephony.TelephonyManager; import android.util.Base64; import android.view.View; import android.widget.Button; import android.widget.TextView; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Main{ public static void setText(View view, String str) { if (!isBlank(str)) { if (view instanceof TextView || view instanceof Button) { ((TextView) view).setText(str); }/*www .j a v a 2 s. c o m*/ if (view instanceof Button) { ((Button) view).setText(str); } } else { if (view instanceof TextView || view instanceof Button) { ((TextView) view).setText(""); } } } }