1 /*
2  * Copyright (C) 2007 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 android.widget.focus;
18 
19 import com.android.frameworks.coretests.R;
20 
21 import android.app.Activity;
22 import android.os.Bundle;
23 import android.os.Handler;
24 import android.widget.Button;
25 
26 /**
27  * Exercises cases where elements of the UI are requestFocus()ed.
28  */
29 public class RequestFocus extends Activity {
30     protected final Handler mHandler = new Handler();
31 
onCreate(Bundle icicle)32     @Override protected void onCreate(Bundle icicle) {
33         super.onCreate(icicle);
34         setContentView(R.layout.focus_after_removal);
35 
36         // bottom right button starts with the focus.
37         final Button bottomRightButton = findViewById(R.id.bottomRightButton);
38         bottomRightButton.requestFocus();
39         bottomRightButton.setText("I should have focus");
40     }
41 
getHandler()42     public Handler getHandler() {
43         return mHandler;
44     }
45 }
46