findviewbyid in fragment Ask Question
By       03-Sep-2024    1

I have created a fragment with some controls ,so the issue is that i want to find these controls for manuplate some  value ,how i can get these controls

Solutions


Nawab

you can find these controls as below on onViewCreated

@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    textview tv= (textview ) getView().findViewById(R.id.tv);

OR

View view = inflater.inflate(R.layout.testclassfragment, container, false);
      textview tv==  view.findViewById(R.id.tv); 
     return view;

10041
Copyright Future Minutes © 2015- 2024 All Rights Reserved.   Terms of Service  |   Privacy Policy |  Contact US|  Pages|  Whats new?
Update on: Dec 20 2023 05:10 PM