Back to project page clever-weather.
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.
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); } }