Isa
Isa

Reputation: 3

Hello, how can I solve problem in fragment - get edit text to string

private void showAllUserData() {

    Intent validation = getActivity().getIntent();
    String user_username = validation.getStringExtra("username");
    String user_email = validation.getStringExtra("email");
    String user_password = validation.getStringExtra("password");
    String user_name = validation.getStringExtra("name");


    fullNameLabel.setText(user_name);
    userNameLabel.setText(user_username);
    fullname.getEditText().setText.toString(user_name);
    email.getEditText().setText.toString(user_email);
    password.getEditText().setText.toString(user_password);

}}

My get all user data method has a problem here, in the edit text to string section, I don't how to use it in a fragment.

here is how my code looks like in android studio

here is how my code looks like in android studio

Upvotes: 0

Views: 86

Answers (1)

Mr. Robot
Mr. Robot

Reputation: 416

Are full_name_profile, email_profile and password_profile EditTexts in your XML layout? Because in that case, the variables fullname, email and password are already EditTexts and you can just remove getEditText() from your code and set the text like this: fullname.setText(user_username)

Upvotes: 1

Related Questions