I have an ExpandableListView that is created as part of the action:
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.news); // create the exandable list view widget newsListAdapter = new NewsListAdapter(this.getApplicationContext()); newsListView = (ExpandableListView) findViewById(R.id.news_list_view); newsListView.setAdapter(newsListAdapter); final Button homeButton = (Button) findViewById(R.id.home_btn); // go back to the home page homeButton.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { startActivity(new Intent(view.getContext(), HomeActivity.class)); } }); newsListView.setOnGroupClickListener(new OnGroupClickListener() { public boolean onGroupClick(ExpandableListView parent, View view, int groupPosition, long arg3) { return false; } }); newsListView.setOnChildClickListener(new OnChildClickListener() { public boolean onChildClick(ExpandableListView parent, View view, int groupPosition, int childPosition, long id) { return false; } }); showLoadingProgressDialog(); downloadRssFeedTask = new DownloadRssFeedTask(); downloadRssFeedTask.execute(); }
as you can see from the code, it disconnects and pulls the RSS feed into AsyncTask.
When AsyncTask is finished, the progress dialog is rejected and it is reported that the task has completed:
private void responseReceived(Channel newsResponse) { if (newsResponse != null) newsListAdapter.buildView(newsResponse); } else { Toast toast = Toast.makeText(this.getApplicationContext(), "There is no news available at this time.", Toast.LENGTH_LONG); toast.show(); } }
However, the ExpandableListView does not redraw / update itself after loading the data, it is a blank screen. How do you get an ExpandableListView to update RSS data? I tried invalidate and refreshDrawableState , but there was no joy.
Thoughts?
source share