我創建了一個進度條,但我看不到加載動畫。它凍結了。當我點擊該項目時,我想顯示一個進度條,然後看到該工作欄正在工作,而不是凍結。這裏是我的代碼:進度條不更新
lv.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
if (((TextView) view).getText().equals("Zman-New (rus)")){
progDailog = ProgressDialog.show(testLoading.this, "Getting data", "Loading...",true,true);
new GetDataTask("stringurl.xml").execute();
}
這裏是的GetData
private class GetDataTask extends AsyncTask<Void, Void, Integer> {
String url;
GetDataTask(String url){
this.url=url;
}
@Override
protected Integer doInBackground(Void... params) {
//do all your backgroundtasks
intent = new Intent(rusNewsP.testLoading.this, rusNewsTest.rusNewsActivite.class);
intent.putExtra("url",url);
startActivity(intent);
finish();
return 1;
}
@Override
protected void onPostExecute(Integer result) {
//finish up (or close the progressbar)
//do something with the result
progDailog.dismiss();
super.onPostExecute(result);
}
}