简体   繁体   中英

editText.getText().append in fragment is not working

i use customlistener in adapter(used for recyclerview). if view is clicked, i handle the event in fragment. (the event is editText.getText().append) problem is my customlistener is work well but i can append texts and when i check edittext by using editText.getText,then there is not thing...

public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState){
final View root=inflater.inflate(R.layout.fragment,container,false)
editText=root.findViewById(R.Id.editText);
ad.setOnItenListener(new webTomainadaper.OnItemClickListener(){
public void OnItemClick(String s, int position){
editText.getText().append(s);
}
})}

Use

editText.setText().append(editText.getText().append(s));

What you were doing is that you are only requesting the text inside the editText , not updating the view (editText)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM