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

public static String getText(TextView tv) {
    return tv.getText().toString().trim();
}

From source file:Main.java

public static String getTextViewValue(TextView etName) {
    return etName.getText().toString().toString();
}

From source file:Main.java

public static String getTextContent(TextView textView) {
    return textView.getText().toString().trim();
}

From source file:Main.java

public static boolean isTVEmpty(TextView tv) {
    return tv.getText().toString().trim().length() == 0;
}

From source file:Main.java

/**
 * Return whether Edit text is empty//  www. ja  v a 2  s.com
 * @return
 */
public static boolean isTextViewNotEmpty(TextView textView) {
    return textView.getText() != null && !textView.getText().toString().equals("");
}

From source file:Main.java

/**
 * Returns the text for a {@link TextView}.
 *
 * @param textview   text view instance/*from  w w  w.  j a va 2 s.  c o m*/
 * @return  text shown in text view
 */
public static String getText(TextView textview) {
    return textview.getText().toString();
}

From source file:Main.java

public static void setUnderLine(TextView tv) {
    if (tv.getText() != null) {
        String udata = tv.getText().toString();
        SpannableString content = new SpannableString(udata);
        content.setSpan(new UnderlineSpan(), 0, udata.length(), 0);
        tv.setText(content);//from w w w  .ja v  a2s.  co m
        content.setSpan(new UnderlineSpan(), 0, udata.length(), 0);
    } else {
        tv.getPaint().setFlags(Paint.UNDERLINE_TEXT_FLAG);
    }
}

From source file:Main.java

static public boolean isNullOrEmpty(TextView tv) {
    return isNullOrEmpty(tv.getText());
}

From source file:Main.java

public static void formatHtml(TextView tv) {
    tv.setText(Html.fromHtml(tv.getText().toString()));
}

From source file:Main.java

public static int readTime(TextView tv) {
    String timeText = tv.getText().toString();
    String[] timeArr = timeText.split(":");
    if (timeArr != null && timeArr.length > 1) {
        int sec = Integer.parseInt(timeArr[1]);
        int min = Integer.parseInt(timeArr[0]);
        return (60 * min) + sec;
    }//from   www. j  av  a  2  s  . c om
    return 0;
}