Xml 如何仅在片段中单击侦听器之后调用oncreateView?

Xml 如何仅在片段中单击侦听器之后调用oncreateView?,xml,android-fragments,fragment-oncreateview,Xml,Android Fragments,Fragment Oncreateview,在下面的代码中,我只是试图从EditText中获取登录的值,并从片段中获取密码。它们都不返回任何值,因为它们都在加载应用程序时检索到了值。我注意到onCreateView在加载应用程序时只调用一次,并且在加载后输入Edittext值时从不返回 公共类片段\登录扩展片段{ EditText login; EditText password; Button send; String USERNAME ; // your account

在下面的代码中,我只是试图从EditText中获取登录的值,并从片段中获取密码。它们都不返回任何值,因为它们都在加载应用程序时检索到了值。我注意到onCreateView在加载应用程序时只调用一次,并且在加载后输入Edittext值时从不返回

公共类片段\登录扩展片段{

        EditText login;
        EditText password;
        Button send;
        String USERNAME ;  // your account's username
        String PASSWORD ;   // your account's password
       
        private static final String ARG_PARAM1 = "param1";
        private static final String ARG_PARAM2 = "param2";
        private String mParam1;
        private String mParam2;
    
    
        public fragment_login() {
            // Required empty public constructor
        }
    

        public static fragment_login newInstance(String param1, String param2) {
            fragment_login fragment = new fragment_login();
            Bundle args = new Bundle();
            args.putString(ARG_PARAM1, param1);
            args.putString(ARG_PARAM2, param2);
    
    
            fragment.setArguments(args);
            return fragment;
        }
    
        @Override
        public View onCreateView(LayoutInflater inflater, ViewGroup container,
                                 Bundle savedInstanceState) {
            // Inflate the layout for this fragment
            View v = inflater.inflate(R.layout.fragment_login, container, false);
            login = v.findViewById(R.id.et_email);
            String bing=login.getText().toString();
            password = v.findViewById(R.id.et_password);
            String bong=password.getText().toString();
    
            send = v.findViewById(R.id.btn_login);
             return v;
    
        }

        @Override
        public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    
          
            send.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
    
                    callFunction();
    
                }
            });
        }