WeatherInformation: message when no chosen location
authorgu.martinm@gmail.com <gu.martinm@gmail.com>
Mon, 22 Sep 2014 00:39:14 +0000 (02:39 +0200)
committergu.martinm@gmail.com <gu.martinm@gmail.com>
Mon, 22 Sep 2014 00:39:14 +0000 (02:39 +0200)
Android/WeatherInformation/src/de/example/exampletdd/WeatherTabsActivity.java

index cf89a7c..168ab2e 100644 (file)
@@ -22,7 +22,6 @@ import de.example.exampletdd.model.WeatherLocation;
 
 public class WeatherTabsActivity extends FragmentActivity {
     private static final int NUM_ITEMS = 2;
-    private TabsAdapter mAdapter;
     private ViewPager mPager;
     
     @Override
@@ -30,10 +29,8 @@ public class WeatherTabsActivity extends FragmentActivity {
         super.onCreate(savedInstanceState);
         this.setContentView(R.layout.fragment_pager);
 
-        this.mAdapter = new TabsAdapter(this.getSupportFragmentManager());
-
         this.mPager = (ViewPager)this.findViewById(R.id.pager);
-        this.mPager.setAdapter(this.mAdapter);
+        this.mPager.setAdapter(new TabsAdapter(this.getSupportFragmentManager()));
 
 
         this.mPager.setOnPageChangeListener(
@@ -128,11 +125,14 @@ public class WeatherTabsActivity extends FragmentActivity {
         final ActionBar actionBar = this.getActionBar();
         
         // 1. Update title.
-        final DatabaseQueries query = new DatabaseQueries(this);
+        final DatabaseQueries query = new DatabaseQueries(this.getApplicationContext());
         final WeatherLocation weatherLocation = query.queryDataBase();
         if (weatherLocation != null) {
             // TODO: I18N and comma :/
             actionBar.setTitle(weatherLocation.getCity() + "," + weatherLocation.getCountry());        
+        } else {
+               // TODO: static resource
+               actionBar.setTitle("no chosen location");
         }
 
         // 2. Update forecast tab text.