@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mAdapter = new ListViewAdapter(); mAdapter.setOnItemClickListener(this); mAppInfos = DataSource.getInstance().getData(); for (AppInfo info : mAppInfos) { DownloadInfo downloadInfo = DownloadManager.getInstance().getDownloadProgress(info.getUrl()); if (downloadInfo != null) { info.setProgress(downloadInfo.getProgress()); info.setDownloadPerSize( getDownloadPerSize(downloadInfo.getFinished(), downloadInfo.getLength())); info.setStatus(AppInfo.STATUS_PAUSE); } } }
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); listView.setAdapter(mAdapter); mAdapter.setData(mAppInfos); }