未调用自定义Adapter getView()方法
ListView
getCount()
("Inside", "GetView")
碎片
public class ServiceCarListFragment extends Fragment { private String url; private ArrayList<CarDetail> carDetailList = new ArrayList<CarDetail>(); private CarListAdapter adapter; private ListView mList; @Override public void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); url = getActivity().getIntent().getStringExtra("url"); new DownloadCarDetail().execute(url); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // TODO Auto-generated method stub View v = inflater.inflate(R.layout.fragment_service_car_list, container, false); mList = (ListView) v.findViewById(R.id.list); mList.setAdapter(adapter); for (CarDetail car : carDetailList) { // START LOADING IMAGES FOR EACH STUDENT car.loadImage(adapter); } return v; } class DownloadCarDetail extends AsyncTask<String, String, ArrayList<CarDetail>> { @Override protected ArrayList<CarDetail> doInBackground(String... params) { // TODO Auto-generated method stub ArrayList<CarDetail> carDetailList = JsonParser.parseJson(params[0]); return carDetailList; } @Override protected void onPostExecute(ArrayList<CarDetail> carDetailList) { // TODO Auto-generated method stub ServiceCarListFragment.this.carDetailList = carDetailList; Log.d("dccs", String.valueOf(ServiceCarListFragment.this.carDetailList.size())); adapter = new CarListAdapter(getActivity(), ServiceCarListFragment.this.carDetailList); Log.d("dccs", String.valueOf((adapter.getCount()))); } }
慕莱坞森
相关分类