Please tell me what the problem may be: the text in TextView is not replaced (checked, resource IDs do not overlap):
public void updateUserName(TextView textView) { String str = textView.getText().toString(); System.out.println("before_ " + str); textView.setText("my_name"); str = textView.getText().toString(); System.out.println("after_ " + str); } By outputting texts to the console, I found that the textView changes its value (i.e. getText returns "my_name"). However, no changes occur in the application itself. Perhaps the wrong resource id TextView I pass?
I get it in the LoginActivity in the onCreate method (src_name, src_email and src_avatar are declared at the beginning of the LoginActivity class as private TextView and private ViewImage):
NavigationView navigationView = findViewById(R.id.navigation_view); // получаем ID ресурса src_name = navigationView.getHeaderView(0).findViewById(R.id.nav_drawer_header_username); // получаем ID имени src_email = navigationView.getHeaderView(0).findViewById(R.id.nav_drawer_header_useremail); // получаем ID почты src_avatar = navigationView.getHeaderView(0).findViewById(R.id.nav_drawer_header_useravatar); // получаем ID аватара Then I pass it to the user creation function (from there it’s already called the original updateUserName with the src_name, src_email and src_avatar arguments that are still passed).