View Single Post
 
Old July 28th, 2010, 11:11 PM
dbomberg dbomberg is offline
Registered User
 
Join Date: Jan 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 7 Earthquake 2, Earthquake.java, error onActivityResult

I am pretty sure there is an error in the file Earthquake.java
When the user sets a preference and thus the requestCode== SHOW_PREFERENCES , the result of the context menu will not send the desired Activity.RESULT_OK value.

Here is my fix. Any feedback is appreciated.
//BEGINNING OF PROPOSED FIX
Code:
 
    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
//REMOVED super.onActivityResult(requestCode, resultCode, data);

      if (requestCode == SHOW_PREFERENCES)
//REMOVED if (resultCode == Activity.RESULT_OK) 

    	  { 
          updateFromPreferences();
          refreshEarthquakes();
           } 
      
//ADDED:
      else{
    	  super.onActivityResult(requestCode, resultCode, data);
      }
//END OF ADDED CODE
    }
//END OF THIS POST

Last edited by dbomberg; July 28th, 2010 at 11:14 PM.. Reason: adding tags [code] and [/code]