данные в button navigation
Сейчас я начал работать с button navigation и мне надо вписать туда данные и как их найти, ну например eeditText =(EditText) findViewById(R.id.editTextTextPersonName); но я не знаю куда вписывать эти данные и где работать, т.к. там везде стоит privat
package my.file.myapplication1.ui.home;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProvider;
import my.file.myapplication1.R;
public class HomeFragment extends Fragment implements View.OnClickListener {
EditText editText;
Button load;
private HomeViewModel homeViewModel;
public View onCreateView(@NonNull LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) {
homeViewModel =
new ViewModelProvider(this).get(HomeViewModel.class);
View root = inflater.inflate(R.layout.fragment_home, container, false);
final TextView textView = root.findViewById(R.id.text_home);
homeViewModel.getText().observe(getViewLifecycleOwner(), new Observer<String>() {
@Override
public void onChanged(@Nullable String s) {
textView.setText(s);
}
});
return root;
}
@Override
public void onClick(View v) {
}
}