I want to show imformation of the newwork server on the listview. when I click some item, it will searchs the network again, return some data, show them on the Dialog. I used two AsyncTasks to realize it. But, when I click the item twice(click the item once is ok), it broken. I debugged and found that the second time it even not step into the itemclicklistener method at all. Can't fixed the bug... Any help is greatly appreciated. Here is parts of the codes. firstly onitemclicklistener
private class lvVoteItemOnItemClickListener implements AdapterView.OnItemClickListener {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
long arg3) {
HashMap<String, String> map = (HashMap<String, String>) lvVoteItem.getItemAtPosition(arg2);
if (clickID != Integer.parseInt(map.get("id"))) {
clickID = Integer.parseInt(map.get("id"));
new VoteAccountTask().execute(map.get("id"));
} else {
new AlertDialog.Builder(VoteSummaryActivity.this).setTitle(res)
.setIcon(null)
.setView(null)
.show();
String temp = "";
}
}
}
secondly, the show dialog AsyncTask
public class VoteAccountTask extends AsyncTask<String, Void, String> {
protected String doInBackground(String... param) {
return searchVoteAccountWebservice(Integer.parseInt(param[0]));
}
@Override
protected void onPostExecute(String result) {
//votedetail.itemID + signal + votedetail.vID + signal + votedetail.itemName + signal + votedetail.ifUserDefine + signal + votedetail.creater +signal + votedetail.createDate
super.onPostExecute(result);
res = setStringsByWebString(result, VoteSummaryActivity.this.getString(R.string.datasetserStr1), VoteSummaryActivity.this.getString(R.string.datasetserStr2));
new AlertDialog.Builder(VoteSummaryActivity.this).setTitle(res)
.setIcon(null)
.setView(null)
.show();
}
}