How to access multiple views in a fragment in android?

200 Views Asked by At
HomeFragment.java:

public class HomeFragment extends Fragment {
    FirebaseAuth fAuth;
    String userId;
    Button logout;
    FirebaseFirestore fStore;
    EditText name,no,mail;

    public HomeFragment() {
    }

    public static HomeFragment newInstance(String param1, String param2) {
        HomeFragment fragment = new HomeFragment();
        Bundle args = new Bundle();
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_home, container, false);
        name=(EditText)view.findViewById(R.id.fname);
        mail=(EditText)view.findViewById(R.id.emailid);
        no=(EditText)view.findViewById(R.id.phone);
        return view;
    }

    @Override
    public void onViewCreated(View view, Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);


    }
}

I have my xml file(fragment_home.xml) which contains three TextView's which Iam unable to modify and my app crashes when trying to do so. I need to set my textview with the data from the firebase. Please help me find a solution

0

There are 0 best solutions below