Questions tagged [settext]

The concept of assigning text to a UI element

The concept of assigning text to a UI element.

Does not specifically refer to a programming language-specific or library-specific API but the general concept.

793 questions
119
votes
5 answers

How to print a double with two decimals in Android?

Maybe this is a silly question, but I cannot guess how to solve it if it's not creating a method. Maybe there's a "natural way" to do it, like in C for example. Here's the problem: I have a var: double a; And I want to show it only with 2 or 3…
ArcDare
  • 3,106
  • 4
  • 27
  • 38
45
votes
7 answers

How to change the text of a Button widget in Android?

How can I change the text of an Android Button widget within code and not the XML file?
Skatephone
  • 1,165
  • 2
  • 12
  • 26
28
votes
4 answers

How to clear JTextArea?

I'm trying to clear the JTextArea. Currently, I'm using jtextarea.setText(null); What is the difference if I use jtextarea.setText("");
Lord Rixuel
  • 1,173
  • 6
  • 24
  • 43
22
votes
1 answer

How to setText for QPlainTextEdit?

Qt5's documentation doesn't mention that QPlainTextEdit has setText(QString) like QTextEdit does. But, I don't think it's impossible. The only way I found is to use QTextDocument which can has setPlainText(const QString& text). So I have to do…
Mas Bagol
  • 4,377
  • 10
  • 44
  • 72
19
votes
5 answers

Needing to double click EditText for click listener to respond

I have a section of code where I want to change the text showing in a textView when the user selects an EditText box. The problem I am having is that the textView only changes when I double click the EditText box, one click and there is no change to…
Kurt
  • 767
  • 8
  • 23
18
votes
6 answers

UIButton setTitle forState Not Working

I'm trying to set the text of a UIButton on a new view when a "Next" button is pressed from a previous view. I have set the IBOutlet correctly and I've looked all over for answers to this but it just isn't working at all. Here is a sample of what…
Link
  • 396
  • 1
  • 4
  • 15
18
votes
11 answers

setText on button from another activity android

I have a problem, I want to click on the list, calling a new activity and rename the button to another name. I tried several things, nothing worked, can someone please help me? My class EditarTimes: private AdapterView.OnItemClickListener…
Alan Santos
  • 291
  • 2
  • 5
14
votes
1 answer

Why do we need to add @SuppressLint("SetTextI18n") annotation before concatenating strings in Android Studio

I tried the following code for concatenation of 'number'(integer variable) and '$'(string) but I got a warning from android studio: "Do not concatenate text displayed with setText. Use resource string with placeholders." and suggested me to add…
Keshav Kumar
  • 143
  • 1
  • 1
  • 6
13
votes
5 answers

error: Only the original thread that created a view hierarchy can touch its views

Hi and thank you for looking at my question. I am an intermediate programmer in C but an Android newbie. I have been trying to get a chat programming working. Assuming everything else in the code below works perfectly. The one question I like to ask…
Byte
  • 2,920
  • 3
  • 33
  • 55
13
votes
2 answers

Set the header text of a QTreeView header

I have the same problem as: What is the method to set the text for a QTreeWidget's header? with one difference: I'm using a treeView, not tree widget, so the answer there didn't help. I couldn't find in the documentation any instructions how to…
sara
  • 3,824
  • 9
  • 43
  • 71
12
votes
4 answers

Changing text from another activity

How to dynamically change the content of a TextView from another part of the screen? I have a TabActivity class that draws a RelativeLayout that contains a TextView followed by a with several tabs. Within each tab is a separate Intent. From one of…
ehymel
  • 1,360
  • 2
  • 15
  • 24
11
votes
5 answers

Difference between setText() and append()

I'm curious about the difference setText() and append() are creating. I'm writing a very basic editor with line numbers. I have a TextView to hold line numbers on the left, paired with an EditText on the right to hold the data. Here's the…
CJ Harries
  • 179
  • 1
  • 2
  • 15
11
votes
4 answers

TextView.setText (Android) is causing crashes.. any idea why?

Trying to get started with Android development, and doing some basic work with TextViews.. For some reason TextView's setText() method is causing huge problems for me.. here's a simplified version of my code to show what I mean: package…
Zeldarulah
  • 302
  • 2
  • 6
  • 15
10
votes
2 answers

How to add value (setText) to a material design TextInputLayout?

How do i setText to a material design TextInputLayout (Material Design) in android studio? //setValue BarCode.setText(MainPage.ResultCode.getText()); TextInputLayout BarCode; @Override protected void onCreate(Bundle…
Anesu Phiri
  • 159
  • 1
  • 1
  • 8
10
votes
2 answers

Do not concatenate text displayed with setText. Use resource string with placeholders

I am a newbie in android development, I want to provide a number to setText, I am facing this problem and tried many ways to solve it. Code is: public class GameActivity extends Activity implements View.OnClickListener{ int correctAnswer; …
Shashwat
  • 111
  • 1
  • 1
  • 5
1
2 3
52 53