Adnan Attar
Adnan Attar

Reputation: 357

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);
}

Upvotes: 1

Views: 807

Answers (2)

Prince Emmanuel
Prince Emmanuel

Reputation: 16

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.

Upvotes: 0

Mureinik
Mureinik

Reputation: 311843

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

Upvotes: 1

Related Questions