1 package name.gumartinm.weather.information.activity;
3 import android.app.ActionBar;
4 import android.os.Bundle;
5 import android.support.v4.app.FragmentActivity;
7 import name.gumartinm.weather.information.R;
8 import name.gumartinm.weather.information.model.DatabaseQueries;
9 import name.gumartinm.weather.information.model.WeatherLocation;
11 import java.text.MessageFormat;
12 import java.util.Locale;
14 public class SpecificActivity extends FragmentActivity {
17 protected void onCreate(final Bundle savedInstanceState) {
18 super.onCreate(savedInstanceState);
19 this.setContentView(R.layout.weather_specific);
21 final ActionBar actionBar = this.getActionBar();
23 actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
24 actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE, ActionBar.DISPLAY_SHOW_TITLE);
25 actionBar.setDisplayHomeAsUpEnabled(true);
30 public void onResume() {
34 final DatabaseQueries query = new DatabaseQueries(this);
35 final WeatherLocation weatherLocation = query.queryDataBase();
36 if (weatherLocation != null) {
37 final ActionBar actionBar = this.getActionBar();
38 final String[] array = new String[2];
39 array[0] = weatherLocation.getCity();
40 array[1] = weatherLocation.getCountry();
41 final MessageFormat message = new MessageFormat("{0},{1}", Locale.US);
42 final String cityCountry = message.format(array);
43 actionBar.setTitle(cityCountry);