'Non-static method 'findViewById(int)' cannot be referenced from a static context

17 views Asked by At

public class EarnFragment extends Fragment {

public EarnFragment() {

}

Bottom tk1,tk2,tk3,tk4,tk5;

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    // Inflate the layout for this fragment
    View view = inflater.inflate(R.layout.fragment_earn, container, false);


    tk1 = View.findViewById(R.id.earnbtn2);
    tk2 = View.findViewById(R.id.earnbtn2);
    tk3 = View.findViewById(R.id.earnbtn3);
    tk4 = View.findViewById(R.id.earnbtn4);
    tk5 = View.findViewById(R.id.earnbtn5);

    return view;
}

}

I am trying to use findViewById in framentclass but there is 'Non-static method 'findViewById(int)' cannot be referenced from a static context ' error

0

There are 0 answers