Android Open Source - clever-weather Province Activity






From Project

Back to project page clever-weather.

License

The source code is released under:

GNU General Public License

If you think the Android project clever-weather listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.listotechnologies.cleverweather;
/*from  w  w  w .  ja v a2  s .  c  o  m*/
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.MenuItem;

public class ProvinceActivity extends Activity {

    private static final String EXTRA_PROVINCE_ABBR = "EXTRA_PROVINCE_ABBR";
    private static final String EXTRA_PROVINCE_NAME = "EXTRA_PROVINCE_NAME";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        String provName = getIntent().getStringExtra(EXTRA_PROVINCE_NAME);
        if (provName != null)
            setTitle(provName);

        if (savedInstanceState == null) {
            String provAbbr = getIntent().getStringExtra(EXTRA_PROVINCE_ABBR);
            getFragmentManager().beginTransaction().add(android.R.id.content, CitiesFragment.newProvinceInstance(provAbbr)).commit();
        }
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
            case android.R.id.home:
                onBackPressed();
                return true;
        }
        return(super.onOptionsItemSelected(item));
    }

    public static void start(Context context, ProvincesFragment.Province province) {
        Intent intent = new Intent(context, ProvinceActivity.class);
        intent.putExtra(ProvinceActivity.EXTRA_PROVINCE_ABBR, province.Abbreviation);
        intent.putExtra(ProvinceActivity.EXTRA_PROVINCE_NAME, province.Name);
        context.startActivity(intent);
    }
}




Java Source Code List

com.example.android.common.view.SlidingTabLayout.java
com.example.android.common.view.SlidingTabStrip.java
com.listotechnologies.cleverweather.ApplicationTest.java
com.listotechnologies.cleverweather.CitiesFragment.java
com.listotechnologies.cleverweather.CleverWeatherDbHelper.java
com.listotechnologies.cleverweather.CleverWeatherProviderClient.java
com.listotechnologies.cleverweather.CleverWeatherProviderExtended.java
com.listotechnologies.cleverweather.CleverWeatherProvider.java
com.listotechnologies.cleverweather.ForecastParser.java
com.listotechnologies.cleverweather.ForecastsActivity.java
com.listotechnologies.cleverweather.ForecastsFragment.java
com.listotechnologies.cleverweather.LocationGetter.java
com.listotechnologies.cleverweather.LocationHelper.java
com.listotechnologies.cleverweather.ProvinceActivity.java
com.listotechnologies.cleverweather.ProvincesFragment.java
com.listotechnologies.cleverweather.SearchCitiesActivity.java
com.listotechnologies.cleverweather.TabbedActivity.java
com.listotechnologies.cleverweather.TwoPaneFragment.java