Home | History | Annotate | Download | only in focus
      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.LinearLayout;
     25 import android.widget.Button;
     26 import android.view.View;
     27 
     28 /**
     29  * Exercises cases where elements of the UI are requestFocus()ed.
     30  */
     31 public class RequestFocus extends Activity {
     32     protected final Handler mHandler = new Handler();
     33 
     34     @Override protected void onCreate(Bundle icicle) {
     35         super.onCreate(icicle);
     36         setContentView(R.layout.focus_after_removal);
     37 
     38         // bottom right button starts with the focus.
     39         final Button bottomRightButton = (Button) findViewById(R.id.bottomRightButton);
     40         bottomRightButton.requestFocus();
     41         bottomRightButton.setText("I should have focus");
     42     }
     43 
     44     public Handler getHandler() {
     45         return mHandler;
     46     }
     47 }
     48