Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class DealsView extends BaseListView {
- /** Called when the activity is first created. */
- @Override
- public void onCreate(Bundle savedInstanceState) {
- Log.d(TAG, "onCreate()");
- super.onCreate(savedInstanceState);
- setActionBarContentView(R.layout.deals_view);
- mAdapter = new DealAdapter(this);
- downloadDealsFeed();
- }
- private void downloadDealsFeed() {
- ...
- }
- @Override
- public void handleXmlParsed() {
- Log.d(TAG, "handleXMLParsed()");
- runOnUiThread(new Runnable() {
- @Override
- public void run() {
- setListAdapter(mAdapter);
- }
- });
- updateListView();
- }
- private void updateListView() {
- runOnUiThread(new Runnable() {
- @Override
- public void run() {
- Log.d(TAG, "updateListView()");
- mDealsModel = ModelManager.getInstance().getDealsModel();
- mDeals = mDealsModel.getDeals();
- try{
- mAdapter.notifyDataSetChanged();
- }
- catch(IllegalStateException e) {
- Log.e(TAG, "Error Updating Adapter/ListView", e);
- }
- }
- });
- }
- private class DealAdapter extends ArrayAdapter<DealModel> {
- ...
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement