List of usage examples for android.widget TextView getText
@ViewDebug.CapturedViewProperty
public CharSequence getText()
From source file:Main.java
public static String get_TextView_string(Activity activity, int what) { TextView ans = (TextView) activity.findViewById(what); String str = (String) ans.getText(); return str;/* www.j a v a 2 s .c o m*/ }
From source file:Main.java
public static Calendar viewText2Calendar(TextView tv) { final String date = tv != null ? tv.getText().toString() : ""; return string2Calendar(date); }
From source file:Main.java
public static void setPartialSizeAndColor(TextView tv, int start, int end, int textSize, int textColor) { String s = tv.getText().toString(); Spannable spannable = new SpannableString(s); spannable.setSpan(new AbsoluteSizeSpan(textSize, false), start, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); spannable.setSpan(new ForegroundColorSpan(textColor), start, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); tv.setText(spannable);/*from w w w . j a v a 2 s . co m*/ }
From source file:Main.java
/** * Returns the text content of the view with the given resourceId. *///w w w . j a v a 2s .co m private static String getText(View view, int resourceId) { view = view.getRootView(); TextView textView = TextView.class.cast(view.findViewById(resourceId)); return textView.getText().toString(); }
From source file:Main.java
public static String trim(TextView tv) { if (tv == null) return null; return tv.getText().toString().trim(); }
From source file:Main.java
public static void applyTextEmoticon(Context context, TextView view) { view.setText(getEmoticonText(context, view.getText())); }
From source file:Main.java
private static void makeHtml(ViewGroup viewGroup) { for (int i = 0; i < viewGroup.getChildCount(); i++) { final View childView = viewGroup.getChildAt(i); if (childView instanceof TextView) { final TextView curr = (TextView) childView; curr.setText(Html.fromHtml(curr.getText().toString())); }//from w w w . java 2s . c om if (childView instanceof ViewGroup) { makeHtml((ViewGroup) childView); } } }
From source file:Main.java
public static void makeTextViewHyperlink(TextView tv) { SpannableStringBuilder ssb = new SpannableStringBuilder(); ssb.append(tv.getText()); ssb.setSpan(new URLSpan("#"), 0, ssb.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); tv.setText(ssb, TextView.BufferType.SPANNABLE); }
From source file:Main.java
public static boolean isEmptyTextView(TextView tv) { if (tv == null) { return true; }//from ww w . ja va 2s.com if ("".equals(tv.getText().toString())) { return true; } else { return false; } }
From source file:Main.java
public static String getNumTVAsString(TextView tv) { if (isTVEmpty(tv)) { return "0"; } else {/* www . ja va 2s . c o m*/ return tv.getText().toString(); } }