Best code examples for TextView setText method (android.widget.TextView.setText)

These code examples were ranked by Codota’s semantic indexing as the best open source examples for TextView setText method.
You can now enable Codota on your own code to easily search and navigate your Java codebase.

TextView setText examples from Open Source projects
This code example shows how to use the following methods: setPadding, setText, setTextColor, setTextSize
174:	textView.setPadding((int)(20 * scale) * (leftPadding ? 2 : 1), (int)(20 * scale) * (!leftPadding && topPadding ? 1 : 0), (int)(20 * scale), 0); 
175:	textView.setText(item); 
176:	textView.setTextColor(Color.BLACK); 
177:	textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 16); 
Full Snippet Info
9
CodeRank
This code example shows how to use the following methods: getVisibility, setVisibility, setText
116:	mTitleView.setText(title); 
-
118:	if (mTitleView.getVisibility() != VISIBLE) mTitleView.setVisibility(VISIBLE); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setLayoutParams, setGravity, setText
122:	TextView tv = new TextView(getActivity()); 
123:	tv.setLayoutParams(new ViewGroup.LayoutParams(MATCH_PARENT, 
-
125:	tv.setText("Fragment #" + mNum); 
126:	tv.setGravity(CENTER); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setText
80:	TextView txt=new TextView(this); 
-
90:	txt.setText(String.valueOf(runtime)+" seconds since activity launched"); 
-
93:	getListView().postDelayed(new Runnable() { 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setId, setVisibility, setGravity, setPadding, setText
95:	mStandardEmptyView = new TextView(context); 
96:	mStandardEmptyView.setId(INTERNAL_EMPTY_ID); 
97:	mStandardEmptyView.setGravity(Gravity.CENTER); 
98:	mStandardEmptyView.setVisibility(View.GONE); 
99:	mStandardEmptyView.setPadding(10, 15, 10, 15); 
100:	mStandardEmptyView.setText("That's all, folks!"); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setLayoutParams, setCompoundDrawablesWithIntrinsicBounds, setGravity, setPadding, setText
142:	TextView textView = new TextView(ActivityPickerActivity.this); 
143:	textView.setLayoutParams(lpGroup); 
144:	textView.setGravity(Gravity.CENTER_VERTICAL | Gravity.LEFT); 
145:	textView.setPadding(leftPadding, 0, 0, 0); 
-
172:	textView.setText(info.applicationInfo.loadLabel(mPackageManager)); 
173:	textView.setCompoundDrawablesWithIntrinsicBounds(Utilities.createIconThumbnail(info.applicationInfo.loadIcon(mPackageManager),ActivityPickerActivity.this), null, null, null); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setTag, setVisibility, setText
109:	view.setText(html); 
-
113:	view.setVisibility(VISIBLE); 
114:	view.setTag(null); 
-
119:	view.setText(null); 
120:	view.setVisibility(GONE); 
121:	view.setTag(null); 
-
180:	view.setTag(id); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setGravity, setPadding, setText, setTextSize
65:	TextView scoreText = new TextView(parent.getContext()); 
66:	scoreText.setText(String.valueOf(score.getScore())); 
67:	scoreText.setGravity(Gravity.RIGHT); 
68:	scoreText.setPadding(10, 10, 10, 10); 
69:	scoreText.setTextSize(16); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setLayoutParams, setGravity, setText
136:	TextView tv = new TextView(getActivity()); 
137:	tv.setLayoutParams(new ViewGroup.LayoutParams(MATCH_PARENT, MATCH_PARENT)); 
138:	tv.setText("Fragment #" + mNum); 
139:	tv.setGravity(CENTER); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setLayoutParams, setGravity, setPadding, setText
116:	TextView textView = new TextView(ExpandableList1.this); 
117:	textView.setLayoutParams(lp); 
-
119:	textView.setGravity(Gravity.CENTER_VERTICAL | Gravity.LEFT); 
-
121:	textView.setPadding(36, 0, 0, 0); 
-
128:	textView.setText(getChild(groupPosition, childPosition).toString()); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setVisibility, setText
427:	v.setText(text); 
-
430:	v.setVisibility(View.GONE); 
-
432:	v.setVisibility(View.VISIBLE); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setText
25:	helloTextView.setText(helloMessage); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setLayoutParams, setText, setTextColor, setTextSize
69:	textView = new TextView(context); 
70:	textView.setTextSize(16); 
71:	textView.setTextColor(0xffffffff); 
72:	textView.setText(textId); 
73:	textView.setLayoutParams(new LinearLayout.LayoutParams( 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setText, setTextColor
308:	subText.setText(error.message()); 
-
311:	subText.setTextColor(Color.RED); 
-
315:	subText.setTextColor(Color.rgb(255,192,0)); 
-
318:	subText.setTextColor(Color.BLUE); 
-
321:	subText.setTextColor(Color.LTGRAY); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setContentDescription, setOnClickListener, setVisibility, setText
91:	mRotateDialogButton1.setVisibility(View.GONE); 
-
124:	mRotateDialogButton1.setText(button1Text); 
125:	mRotateDialogButton1.setContentDescription(button1Text); 
126:	mRotateDialogButton1.setVisibility(View.VISIBLE); 
127:	mRotateDialogButton1.setOnClickListener(new View.OnClickListener() { 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setId, setLayoutParams, setGravity, setText, setTextColor
58:	final TextView title = new TextView(getContext()); 
59:	title.setText(getTitle()); 
60:	title.setTextSize(24); 
61:	title.setTextColor(Color.WHITE); 
62:	title.setTypeface(Typeface.DEFAULT, Typeface.NORMAL); 
63:	title.setGravity(Gravity.LEFT); 
64:	title.setLayoutParams(titleparams); 
65:	title.setId(TITLE_ID); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setText, setTextColor
100:	textView.setText(message); 
101:	textView.setTextColor(color); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setVisibility, setEllipsize, setGravity, setSingleLine, setText
286:	mNameTextView = new TextView(mContext); 
287:	mNameTextView.setSingleLine(true); 
288:	mNameTextView.setEllipsize(TruncateAt.END); 
289:	mNameTextView.setTextAppearance(mContext, android.R.style.TextAppearance_Large); 
290:	mNameTextView.setGravity(Gravity.CENTER_VERTICAL); 
-
293:	mNameTextView.setText(text); 
294:	mNameTextView.setVisibility(View.VISIBLE); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: getText, setText
50:	transcript.setText(transcript.getText().toString()+"Shaking started\n"); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getVisibility, setVisibility, setText
112:	mTitleView.setText(title); 
-
114:	if (mTitleView.getVisibility() != VISIBLE) mTitleView.setVisibility(VISIBLE); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setVisibility, getTypeface, setEllipsize, setSingleLine, setText
251:	mNameTextView = new TextView(mContext); 
252:	mNameTextView.setSingleLine(true); 
253:	mNameTextView.setEllipsize(TruncateAt.END); 
254:	mNameTextView.setTextAppearance(mContext, android.R.style.TextAppearance_Small); 
255:	mNameTextView.setTypeface(mNameTextView.getTypeface(), Typeface.BOLD); 
-
259:	mNameTextView.setVisibility(View.GONE); 
-
261:	mNameTextView.setText(text); 
262:	mNameTextView.setVisibility(View.VISIBLE); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setOnClickListener, setText
37:	Button result = new Button(context); 
38:	result.setText(name); 
39:	result.setOnClickListener(new View.OnClickListener() { 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: getWindowToken, getText, setText
74:	adapter.add(v.getText().toString()); 
75:	v.setText(""); 
-
80:	imm.hideSoftInputFromWindow(v.getWindowToken(), 0); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setText
26:	helloTextView.setText(helloMessage); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setGravity, setMaxWidth, setMinWidth, setPadding, setText
66:	TextView messageText = new TextView(parent.getContext()); 
67:	messageText.setText(this.getMessageText(pos)); 
68:	messageText.setGravity(Gravity.LEFT); 
69:	messageText.setPadding(10, 10, 10, 10); 
70:	messageText.setMaxWidth(200); 
71:	messageText.setMinWidth(200); 
72:	messageText.setTextSize(16); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: getHeight, setGravity, setText, setTextColor, setTextSize
94:	TextView textView = new TextView(context); 
95:	textView.setText(prompt); 
96:	textView.setTextSize(14); 
97:	textView.setTextColor(Color.BLACK); 
-
104:	LinearLayout.LayoutParams.WRAP_CONTENT,textView.getHeight()); 
-
108:	textView.setGravity(Gravity.CENTER); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: getVisibility, setVisibility, setText
116:	mTitleView.setText(title); 
-
118:	if (mTitleView.getVisibility() != VISIBLE) mTitleView.setVisibility(VISIBLE); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: getLinksClickable, getText, setMovementMethod, setText
34:	CharSequence content = view.getText(); 
35:	view.setText(convertNormalStringToSpannableString(content.toString())); 
36:	if (view.getLinksClickable()) { 
37:	view.setMovementMethod(LongClickableLinkMovementMethod.getInstance()); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: getText, setText
161:	mLog.setText(mLog.getText() + "\n" + mDateFormat.format(new Date()) + ": " + s); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setLayoutParams, setText, setTextSize, setTypeface
42:	tvFormattedName.setText("Add " + bookmark.getName()); 
43:	tvFormattedName.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18); 
44:	tvFormattedName.setTypeface(Typeface.DEFAULT_BOLD); 
-
48:	tvFormattedName.setLayoutParams(para); 
-
58:	tvFormattedName.setText("[" + bookmark.getObjectType() + "] " + bookmark.getName()); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: getContext, setCompoundDrawablePadding, setCompoundDrawablesWithIntrinsicBounds, setPadding, setText
81:	button.setText(buttonDef.getText()); 
-
85:	button.setPadding(0, 0, 0, 0); 
-
87:	final Drawable drawable = button.getContext().getResources().getDrawable(drawableResId); 
88:	button.setCompoundDrawablesWithIntrinsicBounds(null, drawable, null, null); 
89:	button.setCompoundDrawablePadding(0); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setLinkTextColor, setMovementMethod, setPadding, setText, setTextColor
46:	TextView tv = new TextView(this); 
47:	tv.setTextColor(0xffffffff); 
48:	tv.setLinkTextColor(0xffa3b8fe); 
-
50:	tv.setPadding(p, p, p, p); 
51:	tv.setText(Html.fromHtml(getIntent().getStringExtra("info"))); 
52:	tv.setMovementMethod(LinkMovementMethod.getInstance()); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setOnClickListener, setTag, setText
90:	Button mButton = new Button(mContext); 
91:	mButton.setText(aText); 
92:	mButton.setTag(Integer.toString(aCallback)); 
93:	mButton.setOnClickListener(this); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: getText, setText
29:	TextView textView = new TextView(context); 
30:	textView.setText(Html.fromHtml("<b>some</b> html text")); 
31:	assertThat(textView.getText().toString()).isEqualTo("<b>some</b> html text"); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: getVisibility, setVisibility, setText
116:	mTitleView.setText(title); 
-
118:	if (mTitleView.getVisibility() != VISIBLE) mTitleView.setVisibility(VISIBLE); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setTag, setText
105:	text.setText(mStrings[position]); 
-
107:	text.setTag(null); 
-
109:	text.setText("Loading..."); 
-
111:	text.setTag(this); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setGravity, setText, setTextSize
13:	TextView textView = new TextView(this); 
14:	textView.setText("Activity two"); 
15:	textView.setGravity(Gravity.CENTER); 
16:	textView.setTextSize(48); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setText, setTextColor, setTextSize
149:	TextView textView = new TextView(mContext); 
150:	textView.setTextColor(mInactiveTextColor.getColor()); 
151:	textView.setTextSize(16); 
152:	textView.setText(label); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setBackgroundColor, setText
23:	TextView view = new TextView(this); 
24:	view.setText("MostBasicWindow"); 
25:	view.setBackgroundColor(Color.CYAN); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setText, setTextColor, setTextSize, setTypeface
50:	TextView telop = new TextView(this); 
51:	telop.setText("TextViewをVideoViewに重ねます"); 
52:	telop.setTextColor(Color.RED); 
53:	telop.setTextSize(40); 
54:	telop.setTypeface(Typeface.DEFAULT, 1); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setTag, setPadding, setText, setTextSize
278:	TextView label = new TextView(this); 
279:	label.setTag(id); 
280:	label.setText(value); 
281:	label.setTextSize(20); 
282:	label.setPadding(0, 5, 0, 0); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setVisibility, setEllipsize, setSingleLine, setText, setTextAppearance
528:	mDataView.setText(text, 0, size); 
529:	mDataView.setVisibility(VISIBLE); 
-
538:	mDataView = new TextView(mContext); 
539:	mDataView.setSingleLine(true); 
540:	mDataView.setEllipsize(TruncateAt.MARQUEE); 
541:	mDataView.setTextAppearance(mContext, android.R.style.TextAppearance_Small); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setBackgroundColor, setGravity, setText, setTextColor, setTextSize
31:	TextView v = new TextView(getActivity()); 
32:	v.setGravity(Gravity.CENTER); 
33:	v.setTextSize(40); 
34:	v.setTextColor(Color.BLACK); 
35:	v.setBackgroundColor(colour); 
36:	v.setText("Fragment ID: " + identifier); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: setPadding, setText, setTypeface
21:	mText = new TextView(context); 
22:	mText.setPadding(15, 0, 0, 0); 
23:	mText.setTypeface(Typeface.SERIF, 0); 
24:	mText.setText(textSelected.getText()); 
Full Snippet Info
7
CodeRank
Related TextView setText Questions & Answers:
Other TextView setText Examples
15:	          s += "vogella.com ";
16:	        }
17:	        view.setText(s);
18:	    }
19:	}

Read More

51:	    String string = button.getText().toString();
52:	    int hitTarget = Integer.valueOf(string) + 1;
53:	    button.setText(String.valueOf(hitTarget));
54:	  }
55:

Read More

37:	      onLocationChanged(location);
38:	    } else {
39:	      latituteField.setText("Location not available");
40:	      longitudeField.setText("Location not available");
41:	    }
-
38:	    } else {
39:	      latituteField.setText("Location not available");
40:	      longitudeField.setText("Location not available");
41:	    }
42:	  }
-
60:	    int lat = (int) (location.getLatitude());
61:	    int lng = (int) (location.getLongitude());
62:	    latituteField.setText(String.valueOf(lat));
63:	    longitudeField.setText(String.valueOf(lng));
64:	  }
-
61:	    int lng = (int) (location.getLongitude());
62:	    latituteField.setText(String.valueOf(lat));
63:	    longitudeField.setText(String.valueOf(lng));
64:	  }
65:

Read More

31:	
32:			// Diplaying the text
33:			txtPlayCount.setText(now_playing);
34:			txtEarned.setText(earned);
35:		}
-
32:			// Diplaying the text
33:			txtPlayCount.setText(now_playing);
34:			txtEarned.setText(earned);
35:		}
36:	}

Read More

52:	         
53:	        imgIcon.setImageResource(navDrawerItems.get(position).getIcon());        
54:	        txtTitle.setText(navDrawerItems.get(position).getTitle());
55:	        
56:	        // displaying count
-
57:	        // check whether it set visible or not
58:	        if(navDrawerItems.get(position).getCounterVisibility()){
59:	        	txtCount.setText(navDrawerItems.get(position).getCount());
60:	        }else{
61:	        	// hide the counter view

Read More

82:			List<String> lables = new ArrayList<String>();
83:			
84:			txtCategory.setText("");
85:	
86:			for (int i = 0; i < categoriesList.size(); i++) {

Read More

setText Method Overview
See Also