Example usage for android.widget TextView setText

List of usage examples for android.widget TextView setText

Introduction

In this page you can find the example usage for android.widget TextView setText.

Prototype

@android.view.RemotableViewMethod
public final void setText(@StringRes int resid) 

Source Link

Document

Sets the text to be displayed using a string resource identifier.

Usage

From source file:Main.java

public static void mapToAndroidLayoutMapper(Class classObj, Map map, String prefixStr, Activity view) {

    if (map == null) {
        return;/*from  w ww . j av  a 2 s  . c o  m*/
    }

    for (Object keyObj : map.keySet().toArray()) {
        String keyStr = keyObj.toString();
        Field fieldObj = null;
        try {
            fieldObj = classObj.getField(prefixStr + "_" + keyStr);
        } catch (NoSuchFieldException e) {
            continue;
        }
        Object layoutObj = null;
        try {
            layoutObj = fieldObj.get(fieldObj);
        } catch (IllegalAccessException e) {
            continue;
        }
        Integer layoutIntvalue = (Integer) layoutObj;

        View selectedView = view.findViewById(layoutIntvalue);

        if (selectedView instanceof TextView) {
            TextView textView = (TextView) selectedView;
            textView.setText((String) map.get(keyStr));
        } else if (selectedView instanceof ImageView) {
            ImageView imageView = (ImageView) selectedView;

        }

    }

}

From source file:Main.java

public static void appendToStartOfLog(TextView log, String appendThis) {
    String currentLog = log.getText().toString();
    currentLog = appendThis + "\n" + currentLog;
    log.setText(currentLog);
}

From source file:Main.java

private static TextView upgrade(View view, int stringId, String upgradeValue) {

    final TextView upgrade = (TextView) view.findViewById(stringId);
    upgrade.setVisibility(View.VISIBLE);

    if (upgradeValue != null)
        upgrade.setText(upgradeValue);

    return upgrade;
}

From source file:cl.monsoon.s1next.binding.TextViewBindingAdapter.java

@BindingAdapter("relativeDateTime")
public static void setRelativeDateTime(TextView textView, long datetime) {
    textView.setText(DateUtils.getRelativeDateTimeString(textView.getContext(), datetime,
            DateUtils.MINUTE_IN_MILLIS, DateUtils.DAY_IN_MILLIS, 0));
}

From source file:Main.java

private static void UIUpdater(Activity activity, final TextView textView, final String str) {
    activity.runOnUiThread(new Runnable() {
        @Override/*ww w .j  a v  a  2  s .c  om*/
        public void run() {
            textView.setText(str);
        }
    });
}

From source file:Main.java

public static void setStatusMessage(TextView statusText, ProgressBar progressBar, String message) {
    statusText.setVisibility(View.VISIBLE);
    progressBar.setVisibility(View.VISIBLE);
    statusText.setText(message);
}

From source file:Main.java

public static void setFinishedStatusMessage(TextView statusText, ProgressBar progressBar, String message) {
    statusText.setVisibility(View.VISIBLE);
    progressBar.setVisibility(View.INVISIBLE);
    statusText.setText(message);
}

From source file:android.databinding.testapp.adapter.MultiArgTestAdapter.java

@BindingAdapter({ "android:class1", "android:class2" })
public static void setBoth(TextView view, MultiBindingClass1 class1, MultiBindingClass2 class2) {
    view.setText(join(class1, class2));
}

From source file:Main.java

public static void setText(TextView textView, String text) {
    if (textView != null && !TextUtils.isEmpty(text)) {
        textView.setVisibility(View.VISIBLE);
        textView.setText(text);
    }//from   ww w.ja v  a 2s. com
}

From source file:Main.java

private static void createLink(View v, int id, String html) {
    TextView textView = (TextView) v.findViewById(id);
    textView.setClickable(true);/*from   www.j  a v a  2 s  .c  o  m*/
    textView.setMovementMethod(LinkMovementMethod.getInstance());
    textView.setText(Html.fromHtml(html));
}