Back to project page DreamInTweets.
The source code is released under:
Apache License
If you think the Android project DreamInTweets listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
/** * Copyright 2013 Adam Speakman//from w w w. j a v a 2s. c om * * 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 nz.net.speakman.android.dreamintweets.activities; import nz.net.speakman.android.dreamintweets.R; import nz.net.speakman.android.dreamintweets.fragments.LicensesFragment; import android.app.Activity; import android.app.DialogFragment; import android.app.Fragment; import android.app.FragmentTransaction; import android.view.Menu; import android.view.MenuItem; /** * @author Adam * */ public class DreamActivity extends Activity { @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.action_licenses: showLicensesDialog(); return true; default: return super.onOptionsItemSelected(item); } } private void showLicensesDialog() { // Create & show a licenses fragment just as you would any other DialogFragment. FragmentTransaction ft = getFragmentManager().beginTransaction(); Fragment prev = getFragmentManager().findFragmentByTag("licensesDialogFragment"); if (prev != null) { ft.remove(prev); } ft.addToBackStack(null); // Create and show the dialog. DialogFragment newFragment = LicensesFragment.newInstance(); newFragment.show(ft, "licensesDialogFragment"); } }