大家好的Android开发者 我点击下载按钮尝试下载内容,然后更新该行的Textview以显示下载状态
public OnlineStoreAdapter extends
ArrayAdapter<MusicDownloadStructure>{
public View getView(int position, View view, ViewGroup parent) {
// TODO Auto-generated method stub
final MusicDownloadStructure data = ModelDownloadData[position];
.
.
Downloadbtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
downloadmanager = new ModelDownload(URL, data);
downloadmanager.execute();
}
}
}
public class ModelDownload extends AsyncTask<Object, Long, Boolean> {
public ModelDownload(String URL, MusicDownloadStructure downloadStructure) {
connectionurl = URL;
DownloadStructure = downloadStructure;
}
protected void onPostExecute(Boolean result) {
// TODO Auto-generated method stub
TextView statusTextView = DownloadStructure.getStatusTextView();
statusTextView.setText(TitleStirng);
}
我在数据对象中保留目标文本视图的参考并更改Asynctask中的文本,但我不知道为什么文本没有改变没有人可以帮忙? 罐
答案 0 :(得分:1)
尝试拨打notifyDataSetChanged
:
protected void onPostExecute(Boolean result) {
...
myListView.notifyDataSetChanged(); //or simply notifyDataSetChanged if your Async inside adapter
}