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