Java tutorial
//package com.java2s; //License from project: Open Source License import android.text.SpannableString; import android.view.View; import android.widget.EditText; import android.widget.TextView; public class Main { private static void viewSetText(View textView, SpannableString mSpannableString) { if (textView instanceof TextView) { TextView tv = (TextView) textView; tv.setText(mSpannableString); } else if (textView instanceof EditText) { EditText et = (EditText) textView; et.setText(mSpannableString); } } }