Java tutorial
/* * Copyright (C) 2011-2012 asksven * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.asksven.commandcenter; import com.asksven.android.system.Devices; import android.content.SharedPreferences; import android.content.res.Configuration; import android.os.Bundle; import android.preference.PreferenceManager; import android.support.v4.app.FragmentActivity; /** * @author sven * */ /** * This is a secondary activity, to show what the user has selected * when the screen is not large enough to show it all in one activity. */ public class BasicDetailsActivity extends FragmentActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this); boolean bForceDualPane = preferences.getBoolean("dualPaneOnSmallScreens", false); if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) { if (bForceDualPane || Devices.isTablet(this)) { // If the screen is now in landscape mode, we can show the // dialog in-line with the list so we don't need this activity. finish(); return; } } if (savedInstanceState == null) { // During initial setup, plug in the details fragment. BasicDetailsFragment details = new BasicDetailsFragment(); details.setArguments(getIntent().getExtras()); getSupportFragmentManager().beginTransaction().add(android.R.id.content, details).commit(); } } }