View Single Post
 
Old November 30th, 2012, 05:52 AM
Herwig De Smet Herwig De Smet is offline
Registered User
Points: 6, Level: 1
Points: 6, Level: 1 Points: 6, Level: 1 Points: 6, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2012
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Working code for OnAcivityResult Earthquakes

Hi,

Here is the code that works, and replaces the code on page 231


Code:
public void onActivityResult(int requestCode, int resultCode, Intent data) 
	{
		if (requestCode == SHOW_PREFERENCES)
		{ 
			updateFromPreferences();				 
	        Thread thread = new Thread(new Runnable()
	        {
	        	public void run()
	        	{
	        		FragmentManager fragmentManager = getFragmentManager();
	    	        EarthquakeListFragment earthquakeList = 
	    	          (EarthquakeListFragment)fragmentManager.findFragmentById(R.id.EarthquakeListFragment);
	        		earthquakeList.refreshEarthquakes();
	        	}
	        });
	        thread.start();
		} 
		else
		{
			super.onActivityResult(requestCode, resultCode, data);
		}
    }
Regards,
Herwig