我在填充数据到GridView
之后调用parse。
我已经添加了加载小部件(mProgressBar),但它显示了一次时间并保持视图。
获得成功数据后,UI再次加载。加载数据后,mProgressBar挂起。你能帮助我吗?谢谢。 代码:
private void loadData() {
// initialize your items array
mapDownloadAdapter = new MapDownloadAdapter(this);
lvShopMapDownload.setAdapter(mapDownloadAdapter);
mProgressBar.setVisibility(View.VISIBLE);
//show progress_loading .
runOnUiThread(new Runnable() {
public void run() {
final LevelMapProvider imageTypeProvider = new LevelMapProvider(getApplication());
imageTypeProvider.getAllLevelMap(new LevelMapProvider.IGetAllLevelMapsCallback() {
@Override
public void onGetAllLevelMapsSuccess(final List<LevelMapModel> levelMapModels) {
final MapProvider mapProvider = new MapProvider(getApplication());
mapProvider.getAllMap(new MapProvider.IGetAllMapCallback() {
@Override
public void onGetAllMapLevelsSuccess(final List<MapDownloadModel> mapModels) {
if (mapModels.size() >0){
LocalStorage.getSharedInstance(getApplication()).saveListMapDownloaded(mapModels);
}
// mProgressBar.setVisibility(View.GONE);
// mapDownloadAdapter.fillData(mapModels);
}
@Override
public void onTaskFailure(final int statusCode,
final String errorMessage) {
}
});
}
@Override
public void onTaskFailure(int statusCode,
String errorMessage) {
}
});
}
});
//check internet.
if (!CommonUtil.isInternet(this)) {
mTvMessage.setVisibility(View.VISIBLE);
mTvMessage.setText(getResources().getString(R.string.text_message_no_connection));
mProgressBar.setVisibility(View.GONE);
}
}
答案 0 :(得分:0)
当您将数据填充到listview或gridview之类的任何视图时,如果数据太大,那么您的视图可能会卡住。所以最好使用像#34这样的文字;请稍候......&#34;而不是进度条。因此,在您的XML put文本框中代替进度条,然后根据您的要求隐藏或查看。