From: gu.martinm@gmail.com Date: Mon, 22 Sep 2014 00:39:14 +0000 (+0200) Subject: WeatherInformation: message when no chosen location X-Git-Tag: weatherinformation-1.0~130 X-Git-Url: https://git.gumartinm.name/?a=commitdiff_plain;h=a68c03ea8dbfaf1284da9ab5788e129f78a83e07;p=AndroidWeatherInformation WeatherInformation: message when no chosen location --- diff --git a/src/de/example/exampletdd/WeatherTabsActivity.java b/src/de/example/exampletdd/WeatherTabsActivity.java index cf89a7c..168ab2e 100644 --- a/src/de/example/exampletdd/WeatherTabsActivity.java +++ b/src/de/example/exampletdd/WeatherTabsActivity.java @@ -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.