From b8c23b5ae62f4efdb9a2665f909e24fc7461256c Mon Sep 17 00:00:00 2001 From: "gu.martinm@gmail.com" Date: Mon, 22 Sep 2014 02:39:14 +0200 Subject: [PATCH] WeatherInformation: message when no chosen location --- .../src/de/example/exampletdd/WeatherTabsActivity.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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. -- 2.1.4