我有一个tabLayout与2个片段与listView的应用程序,我想从一个URLConnection与Json加载内容,但在Fragment.java文件中我错了:不能解析方法'findViewByID(int)'。错误:无法找到符号方法findviewbyid
public class Fragment1 extends Fragment implements URLConnectionResponse {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
CanteenProvider canProv = new CanteenProvider();
canProv.delegate = this;
canProv.getDishes(getActivity().getApplicationContext());
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.activity_canteen_tab_mensa, container, false);
}
@Override
public void processFinish(List<?> output) {
ListView canteenList = (ListView) findViewById(R.id.mensalistView);
ArrayList<Dish> canteenItemContent = new ArrayList<Dish>();
canteenItemContent = (ArrayList<Dish>)output;
CanteenListAdapter canteenAdapter = new CanteenListAdapter(canteenItemContent, this);
canteenList.setAdapter(canteenAdapter);
}
}