Android Utililty Methods TextView Set

List of utility methods to do TextView Set

Description

The list of methods to do TextView Set are organized into topic(s).

Method

voidsetText(TextView tv, String str)
set Text
if (tv == null) {
    return;
tv.setText(checkStr(str));
voidsetText(TextView tv, int str)
set Text
if (tv == null) {
    return;
tv.setText(str + "");
voidsetHtml(TextView view, String html)
set Html
view.setVisibility(View.GONE);
if (html != null && html.length() != 0) {
    view.setText(Html.fromHtml(html));
    view.setVisibility(View.VISIBLE);
voidsetHtml(Activity activity, View parent, int elementId, int resId)
set Html
TextView view = (TextView) parent.findViewById(elementId);
view.setText(Html.fromHtml(activity.getString(resId)));
voidinitDate(TextView view, int days)
init Date
Calendar c = Calendar.getInstance();
c.add(Calendar.DAY_OF_MONTH, days);
int mYear = c.get(Calendar.YEAR);
int mMonth = c.get(Calendar.MONTH);
int mDay = c.get(Calendar.DAY_OF_MONTH);
String dateStr = new StringBuilder().append(mYear).append("-")
        .append(format(mMonth + 1)).append("-")
        .append(format(mDay)).toString();
...
voidsetBold(TextView tv)
set Bold
TextPaint tp = tv.getPaint();
tp.setFakeBoldText(true);
voidmanageVisibiltyFieldSpeech(Context context, ImageButton button, AutoCompleteTextView text, int idRightof, int idLeftOf, int idBelow)
manage Visibilty Field Speech
PackageManager pm = context.getPackageManager();
List<ResolveInfo> activities = pm.queryIntentActivities(new Intent(
        RecognizerIntent.ACTION_RECOGNIZE_SPEECH), 0);
if (activities.size() == 0) {
    button.setVisibility(View.GONE);
    if ((text != null) && (Integer.valueOf(Build.VERSION.SDK) <= 3)) {
        RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(
                LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT);
...
voidsetupMarquee(TextView textView, String text)
setup Marquee
textView.setText(text);
textView.setEllipsize(TextUtils.TruncateAt.MARQUEE);
textView.setSingleLine();
textView.setSelected(true);