Example usage for android.widget TextView getText

List of usage examples for android.widget TextView getText

Introduction

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

Prototype

@ViewDebug.CapturedViewProperty
public CharSequence getText() 

Source Link

Document

Return the text that TextView is displaying.

Usage

From source file:Main.java

/**
 * check if an TextView is empty, and returns a boolean
 * @param textViews//from w  ww  .  j  av a  2s  . c o  m
 * @return
 */
public static boolean isEmptyMultiTextView(TextView... textViews) {
    for (TextView textView : textViews) {
        if (textView.getText().toString().trim().isEmpty()) {
            return true;
        }
    }
    return false;
}

From source file:Main.java

public static void appendToStartOfLog(TextView log, String appendThis) {
    String currentLog = log.getText().toString();
    currentLog = currentLog + "\n" + appendThis;
    log.setText(currentLog);/*from w  ww.  ja  v a 2s  . co  m*/
}

From source file:Main.java

public static Object extractValueFromView(View view) {
    if (view instanceof Button) {
        Button b = (Button) view;
        return b.getText().toString();
    } else if (view instanceof CheckBox) {
        CheckBox c = (CheckBox) view;//w w  w .  ja  v a  2  s  . c o m
        return c.isChecked();
    } else if (view instanceof TextView) {
        TextView t = (TextView) view;
        return t.getText().toString();
    }
    return null;
}

From source file:Main.java

public static String getString(TextView editText) {

    if (editText == null || editText.getText() == null)
        return null;
    return editText.getText().toString();
}

From source file:Main.java

public static double getDoubleFrom(TextView view) {
    double val = getDoubleFrom(view.getText().toString());

    return val;
}

From source file:Main.java

public static String getContent(TextView textView) {
    if (textView != null) {
        return textView.getText().toString().trim();
    }/*  ww  w. jav  a2s  .  c  om*/
    return null;
}

From source file:Main.java

public static void setPartialColor(TextView tv, int start, int end, int textColor) {
    String s = tv.getText().toString();
    Spannable spannable = new SpannableString(s);
    spannable.setSpan(new ForegroundColorSpan(textColor), start, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
    tv.setText(spannable);/*from w  w w . j a  v a  2s. com*/
}

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);//  w w w .j  av a  2s .c  o m
}

From source file:Main.java

public static String getText(TextView textView) {
    if (textView != null) {
        return textView.getText().toString();
    } else {/*from   w ww .j  ava 2s  . co m*/
        return "";
    }
}

From source file:Main.java

public static String getDateNoWeek(TextView tv) {
    if (tv != null) {
        final String temp = tv.getText().toString();
        return getDateNoWeek(temp);
    }/*  ww w  .jav a2 s  .  co m*/
    return "";
}