Java tutorial
/* Park Catcher Montral Find a free parking in the nearest residential street when driving in Montral. A Montral Open Data project. Copyright (C) 2012 Mudar Noufal <mn@mudar.ca> This file is part of Park Catcher Montral. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ package ca.mudar.parkcatcher.ui.activities; import ca.mudar.parkcatcher.ParkingApp; import ca.mudar.parkcatcher.ui.fragments.DetailsFragment; import ca.mudar.parkcatcher.utils.ActivityHelper; import com.actionbarsherlock.app.SherlockFragmentActivity; import com.actionbarsherlock.view.MenuItem; import android.content.Intent; import android.os.Bundle; import android.support.v4.app.FragmentManager; public class DetailsActivity extends SherlockFragmentActivity { protected static final String TAG = "DetailsActivity"; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getSupportActionBar().setDisplayHomeAsUpEnabled(true); ((ParkingApp) getApplicationContext()).updateUiLanguage(); FragmentManager fm = getSupportFragmentManager(); if (fm.findFragmentById(android.R.id.content) == null) { DetailsFragment details = new DetailsFragment(); fm.beginTransaction().add(android.R.id.content, details).commit(); } } @Override public void onNewIntent(Intent intent) { setIntent(intent); super.onNewIntent(intent); } @Override public boolean onOptionsItemSelected(MenuItem item) { ActivityHelper activityHelper = ActivityHelper.createInstance(this); return (activityHelper.onOptionsItemSelected(item) || super.onOptionsItemSelected(item)); } }