简体   繁体   English

Android:如何使用字符串“pending”检查从MySQL获取的TextView值?

[英]Android: How to check the TextView value that get from MySQL with string “pending”?

Currently, my EditText will display any value that store in a column named 'comment'. 目前,我的EditText将显示存储在名为“comment”的列中的任何值。 But, if the EditText display text "pending" which is retrieved from that column(comment), it should not display automatically. 但是,如果EditText显示从该列(注释)检索的文本“pending”,则不应自动显示。 I want to know, how to avoid the EditText from displaying "pending"?. 我想知道,如何避免EditText显示“挂起”? Should be used if else statement? 应该用if else语句吗? But how? 但是怎么样?

Below is the EditText code that displays a text which is retrieved from MySQL. 下面是EditText代码,显示从MySQL检索的文本。

etComment.setText(user.getComment());

You can use the If-Else condition to avoid display the "pending" in the edit text. 您可以使用If-Else条件来避免在编辑文本中显示“pending”。

Code: 码:

if(!user.getComment().equals("Pending")){
        etComment.setText(user.getComment());
    }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM