我从网络解析 XML,我想把这些数据放到 GridView 的其他活动中,你能帮帮我吗?
我的第一个活动:
public class HomeScreenActivity extends Activity {
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.imageButton:
Intent intent = new Intent(this, TopArtistsScreen.class);
intent.putExtra("username", username);
new DownloadXmlTask(this, HomeScreenActivity.this)
.execute("URL");
startActivity(intent);
}
我的异步任务
public class DownloadXmlTask extends AsyncTask<String, Void, List<Artist>> {
@Override
protected void onPostExecute(List<Artist> result) {
progressDialog.dismiss();
gridView.setAdapter(new TopArtistsImageAdapter(context, result));
}
TopArtistsImageAdapter
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View view = convertView;
if(convertView==null) {
view = inflater.inflate(R.layout.items, null);
}
TextView textView = (TextView) view.findViewById(R.id.grid_item_name);
ImageView imageView = (ImageView) view.findViewById(R.id.grid_item_image);
textView.setText(artistsList.get(position).getName());
imageLoader.DisplayImage(artistsList.get(position).getImage(), imageView);
return view;
}
PS我应该在下载所有信息后开始另一个活动