简体   繁体   中英

cannot find symbol textView AndroidStudio

I am trying to Pass Data from One Activity to Another Activity in that when when I am writing code to get data in Text View then Showing an error to textView Can Anyone Tell me how resolve this error. I am pasting my code Here Please Check and Tell me. Error At Line Number 12, 14 and 16. at starting "textView"

Error Compiler Showing is:

error: cannot find symbol textView.setText(NameRecive);

symbol: variable textView

location: class 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);
}

The names of the variables you declared are name , surname and number , respectively, not 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

Like @Mureinik said, you don't have the textView variable, only name , surname , and number . I don't have enough reputations to add a comment to his answer.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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