java - 找不到符号textView AndroidStudio

标签 java android android-studio compiler-errors textview

我正在尝试从将数据传递给,将一个 Activity 传递给,将另一个 Activity 传递给,因为当我在编写代码以在“文本 View ”中获取数据时,然后在 textView中显示错误时,有人可以告诉我如何解决此错误。我在这里粘贴我的代码,请检查并告诉我。 在第12、14和16行出现错误。在启动“textView”时
错误编译器显示为:
错误:找不到符号textView.setText(NameRecive);
符号:变量textView
位置:类Barcode_genrator

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_barcode_genrator);

    Intent intent = getIntent();
    String NameRecive = intent.getStringExtra(activity_DataEntry.NAME_TO_SEND);
    String SurnameRecive = intent.getStringExtra(activity_DataEntry.SURNAME_TO_SEND);
    String NumberRecive = intent.getStringExtra(activity_DataEntry.NUMBER_TO_SEND);

    TextView name = findViewById(R.id.FN);
    textView.setText(NameRecive);
    TextView surname = findViewById(R.id.LN);
    textView.setText(SurnameRecive);
    TextView number = findViewById(R.id.MN);
    textView.setText(NumberRecive);
}

最佳答案

您声明的变量名称分别是namesurnamenumber,而不是textView:

TextView name = findViewById(R.id.FN);
name.setText(NameRecive); // Here
TextView surname = findViewById(R.id.LN);
surname.setText(SurnameRecive); // And here
TextView number = findViewById(R.id.MN);
number.setText(NumberRecive); // And here

关于java - 找不到符号textView AndroidStudio,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65263937/

相关文章:

android-layout - 协调布局不适用于选项卡布局

android - 如何让我的 ionic 应用程序以 API 级别 28 及以上为目标

java.lang.StackOverflowError 由于递归

java - Spring 框架: Inserting another JSP file with a JSP file

android - 自动缩放android资源

java - Android Studio:运行项目时出错

Android Studio 崩溃现在无法推送到 GitHub

Javafx自定义单元工厂节点不起作用,但继承了单元工厂中的setText()方法

java - Hibernate ORA-02292 : integrity constraint (ROOT. SYS_C007062) 违反 - 找到子记录

java - 无法解析符号 EvaluatorUtil