1

I am making a simple mobile app. For now I am just testing the app and trying to pass some values in between java files and put them in empty TextViews. I get values from a previous activity via Intent and then trying to pass them on to another activity called ConsultActivity.java:

String username = getIntent().getStringExtra("Identifiant");
final TextView tv = (TextView)findViewById(R.id.TVUsername);
if(username.equals("marcel123")){
    tv.setText("M Dupond");
}
else if(username.equals("tommy1")){
    tv.setText("M Thompson");
}
else if(username.equals("emma89")){
    tv.setText("Mme Sinieux");
}

consult = (ImageView)findViewById(R.id.consult);

consult.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        Intent i=new Intent(MainActivity.this,ConsultActivity.class);
        i.putExtra("Username", tv.getText().toString());
        startActivity(i);
    }
});

However in my ConsultActivity, when I am doing basically the same thing, my equals are highlighted and say "Cannot resolve symbol equals"

String name = getIntent().getStringExtra("Username");
final TextView textV = (TextView)findViewById(R.id.TVUsername2);
if(name.equals("M Dupond")){
    textV.setText("M Dupond");
}
else if(name.equals("M Thompson")){
    textV.setText("M Thompson");
}
else if(name.equals("Mme Sinieux")){
    textV.setText("Mme Sinieux");
}
Sнаđошƒаӽ
  • 16,753
  • 12
  • 73
  • 90
Evgeny
  • 107
  • 3
  • 17

1 Answers1

1

Probably its just a Synchronization problem try with: Sych project with gradle files

enter image description here

Jorgesys
  • 124,308
  • 23
  • 334
  • 268