Please note that the contents of this offline web site may be out of date. To access the most recent documentation visit the online version .
Note that links that point to online resources are green in color and will open in a new window.
We would love it if you could give us feedback about this material by filling this form (You have to be online to fill it)
ActionBarCompat-ListPopupMenu / src / com.example.android.actionbarcompat.listpopupmenu /

MainActivity.java

       
        1
       
       
        /*
       
       
        2
       
       
        * Copyright (C) 2013 The Android Open Source Project
       
       
        3
       
       
        *
       
       
        4
       
       
        * Licensed under the Apache License, Version 2.0 (the "License");
       
       
        5
       
       
        * you may not use this file except in compliance with the License.
       
       
        6
       
       
        * You may obtain a copy of the License at
       
       
        7
       
       
        *
       
       
        8
       
       
        *      http://www.apache.org/licenses/LICENSE-2.0
       
       
        9
       
       
        *
       
       
        10
       
       
        * Unless required by applicable law or agreed to in writing, software
       
       
        11
       
       
        * distributed under the License is distributed on an "AS IS" BASIS,
       
       
        12
       
       
        * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
       
       
        13
       
       
        * See the License for the specific language governing permissions and
       
       
        14
       
       
        * limitations under the License.
       
       
        15
       
       
        */
       
       
        16
       
       
       
       
        17
       
       
        package com.example.android.actionbarcompat.listpopupmenu;
       
       
        18
       
       
       
       
        19
       
       
        import android.os.Bundle;
       
       
        20
       
       
        import android.support.v7.app.ActionBarActivity;
       
       
        21
       
       
       
       
        22
       
       
        /**
       
       
        23
       
       
        * This sample shows you how to use {@link android.support.v7.widget.PopupMenu PopupMenu} from
       
       
        24
       
       
        * ActionBarCompat to create a list, with each item having a dropdown menu.
       
       
        25
       
       
        * <p>
       
       
        26
       
       
        * The interesting part of this sample is in {@link PopupListFragment}.
       
       
        27
       
       
        *
       
       
        28
       
       
        * This Activity extends from {@link ActionBarActivity}, which provides all of the function
       
       
        29
       
       
        * necessary to display a compatible Action Bar on devices running Android v2.1+.
       
       
        30
       
       
        */
       
       
        31
       
       
        public class MainActivity extends ActionBarActivity {
       
       
        32
       
       
       
       
        33
       
       
        @Override
       
       
        34
       
       
        protected void onCreate(Bundle savedInstanceState) {
       
       
        35
       
       
        super.onCreate(savedInstanceState);
       
       
        36
       
       
       
       
        37
       
       
        // Set content view (which contains a PopupListFragment)
       
       
        38
       
       
        setContentView(R.layout.sample_main);
       
       
        39
       
       
        }
       
       
        40
       
       
       
       
        41
       
       
        }