blob: f0b74383f2bc3414550e046384cafae24afd052a [file] [log] [blame]
Fabrice Di Meglio26e432d2011-06-10 14:19:18 -07001/*
2 * Copyright (C) 2011 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
17package com.android.bidi;
18
Fabrice Di Meglio54d69622011-07-15 16:46:44 -070019import android.app.AlertDialog;
Fabrice Di Meglio7af05222011-06-10 15:42:05 -070020import android.app.Fragment;
Fabrice Di Meglio26e432d2011-06-10 14:19:18 -070021import android.os.Bundle;
Fabrice Di Meglio7af05222011-06-10 15:42:05 -070022import android.view.LayoutInflater;
23import android.view.View;
24import android.view.ViewGroup;
Fabrice Di Meglio54d69622011-07-15 16:46:44 -070025import android.widget.Button;
Fabrice Di Meglio26e432d2011-06-10 14:19:18 -070026
Fabrice Di Meglio7af05222011-06-10 15:42:05 -070027public class BiDiTestBasic extends Fragment {
Fabrice Di Meglio54d69622011-07-15 16:46:44 -070028
29 private View currentView;
30 private Button alertDialogButton;
31 private String[] items = {"This is a very very very very very very very very very very very long Item1", "Item2"};
32
Fabrice Di Meglio26e432d2011-06-10 14:19:18 -070033 @Override
Fabrice Di Meglio7af05222011-06-10 15:42:05 -070034 public View onCreateView(LayoutInflater inflater, ViewGroup container,
35 Bundle savedInstanceState) {
Fabrice Di Meglio54d69622011-07-15 16:46:44 -070036 currentView = inflater.inflate(R.layout.basic, container, false);
37 return currentView;
38 }
39
40 @Override
41 public void onViewCreated(View view, Bundle savedInstanceState) {
42 super.onViewCreated(view, savedInstanceState);
43
44 alertDialogButton = (Button) currentView.findViewById(R.id.button_alert_dialog);
45 alertDialogButton.setOnClickListener(new View.OnClickListener() {
46 public void onClick(View v) {
47 showDialog();
48 }
49 });
50 }
51
52 private void showDialog() {
53 AlertDialog.Builder builder = new AlertDialog.Builder(currentView.getContext());
54 builder.setSingleChoiceItems(items, 0, null);
55 builder.show();
Fabrice Di Meglio26e432d2011-06-10 14:19:18 -070056 }
57}