blob: edcf13dfd6808e0160a468404eb7e21c8f207d2a [file] [log] [blame]
Scott Su6149e8a2009-04-14 12:18:05 -07001/*
2 * Copyright (C) 2008 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 android.widget.cts;
18
19import java.util.ArrayList;
20import java.util.List;
21
22import android.app.Activity;
23import android.os.Bundle;
24import android.view.ViewGroup.LayoutParams;
25import android.widget.ArrayAdapter;
26import android.widget.ListView;
27
28import com.android.cts.stub.R;
29
30/**
31 * A minimal application for AdapterView test.
32 */
33public class AdapterViewStubActivity extends Activity {
34 private ListView mView;
35
36 /**
37 * Called with the activity is first created.
38 */
39 @Override
40 public void onCreate(Bundle savedInstanceState) {
41 super.onCreate(savedInstanceState);
42 mView = new ListView(this);
43 mView.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,
44 LayoutParams.WRAP_CONTENT));
45 setContentView(mView);
46 }
47
48 public ListView getListView() {
49 return mView;
50 }
51
52 public ArrayAdapter<String> getArrayAdapter() {
53 final List<String> list = new ArrayList<String>();
54 for (int i = 0; i < 4; i++) {
55 list.add("test:" + i);
56 }
57 return new ArrayAdapter<String>(this, R.layout.adapterview_layout, list);
58 }
59}