Android examples for User Interface:TextView Value
find TextView And Set Text
/*/* ww w .j a va 2 s. co m*/ * This file is subject to the terms and conditions defined in * file 'LICENSE.txt', which is part of this source code package. */ //package com.java2s; import android.app.Activity; import android.text.Spanned; import android.text.util.Linkify; import android.view.View; import android.widget.TextView; public class Main { public static TextView findAndSetText(Activity activity, int id, String value) { TextView view = (TextView) activity.findViewById(id); view.setText(value); return view; } public static TextView findAndSetText(View parent, int id, String value) { TextView view = (TextView) parent.findViewById(id); if (view != null && value != null) view.setText(value); return view; } public static TextView findAndSetText(View parent, int id, Spanned value) { TextView view = (TextView) parent.findViewById(id); if (view != null) { view.setText(value); view.setClickable(true); view.setAutoLinkMask(Linkify.ALL); } return view; } }