Can not resolve method 'findViewById(int)'

前端 未结 9 832
孤城傲影
孤城傲影 2021-02-05 03:08

I\'m having a trouble with findViewByid but I can\'t find where the problem is.

Here\'s my FirstFragment class code:

import and         


        
9条回答
  •  太阳男子
    2021-02-05 03:25

    getActivity().findViewById() This works it removes the red colour of findviewby id and it doesnt say cannot resolve symbol but when i put a colin in the end the whole statement is underlined and it says unreachable statement. barChart =(BarChart)getActivity().findViewById(R.id.barchart); I am also doing this in fragment.

提交回复
热议问题