我有以下代码将自定义适配器添加到 listView 但它在我设置适配器的行上给出了以下错误:
android.content.res.Resources$NotFoundException:字符串资源 ID #0x68
public class PackageListFragment extends Fragment {
PackageAdapter packageItemAdapter;
ArrayList<PackageClass> list;
PackageClass packageList;
TextView mainLine;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.activity_aps__main, container, false);
ListView lv = (ListView) rootView.findViewById(R.id.packageList);
try{
list = getAllPackages();
packageItemAdapter = new PackageAdapter(getActivity().getApplicationContext(), 0, list);
lv.setAdapter(packageItemAdapter);
}
}
catch(Exception ex){
Log.e("listItem", ex.toString());
}
return rootView;
}
public ArrayList<PackageClass> getAllPackages() throws Exception{
return new DBFunctions(getActivity().getApplicationContext()).RetrieveAllPackage();
}
}
我究竟做错了什么?我的应用程序甚至没有启动就停止了:(