Cannot resolve method 'setText(double)'
时间: 2024-01-26 09:01:52 浏览: 112
The error message "Cannot resolve method 'setText(double)'" means that there is no method called `setText()` that accepts a double value as an argument.
The `setText()` method is used to set the text of a TextView in Android, and it accepts a String value as an argument. If you want to display the double value in a TextView, you should convert it to a String first using the `String.valueOf()` method.
For example, if you have a double variable called `myDouble` and you want to display its value in a TextView called `myTextView`, you can do it like this:
```
double myDouble = 3.14;
TextView myTextView = findViewById(R.id.myTextView);
myTextView.setText(String.valueOf(myDouble));
```
This will convert the double value to a String and set the text of the TextView to that String.
阅读全文