Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Mobile Development > BOOK: Professional Android 4 Application Development
| Search | Today's Posts | Mark Forums Read
BOOK: Professional Android 4 Application Development
This is the forum to discuss the Wrox book Professional Android 4 Application Development Reto Meier; ISBN: 978-1-1181-0227-5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional Android 4 Application Development section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old March 6th, 2013, 09:14 PM
Registered User
Points: 5, Level: 1
Points: 5, Level: 1 Points: 5, Level: 1 Points: 5, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2013
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 7 part 1 - aa.notifyDataSetChanged() omitted ?

Shouldn't notifyDataSetChanged() be inside the `if' ?

Code:
private void addNewQuake(Quake _quake) {
    Earthquake earthquakeActivity = (Earthquake)getActivity();
    if (_quake.getMagnitude() > earthquakeActivity.minimumMagnitude) {
      // Add the new quake to our list of earthquakes.
      earthquakes.add(_quake);
    }

    // Notify the array adapter of a change.
    aa.notifyDataSetChanged();
  }
As you can see here, aa.notiftyDataSetChanged() is called every time the addNewQuake is called, independently if the quake is added or not. Is that OK ?


Also, in refreshEarthquakes, the list is cleared without notifying the adapter:

Code:
        // Clear the old earthquakes
        earthquakes.clear();
This seems an error to me, isn't it ?


Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 9 Earthquake Part 3 majeedk BOOK: Professional Android 4 Application Development 0 December 1st, 2012 07:30 AM
Earthquake chapter 7 part 2 layingincouch BOOK: Professional Android 4 Application Development 1 October 31st, 2012 05:54 PM
chapter-4, Web Part mns BOOK: Professional SharePoint 2007 Development ISBN: 978-0-470-11756-9 0 October 16th, 2009 03:56 PM
Converting string "aA" to a BigInteger kedklok Java Basics 1 March 4th, 2006 02:33 AM
last occurance omitted - LOOP error? crmpicco Excel VBA 3 May 5th, 2005 01:45 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.