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.view; 18 19 import android.app.Activity; 20 import android.os.Bundle; 21 import android.view.View.OnClickListener; 22 import android.widget.Button; 23 24 import com.android.frameworks.coretests.R; 25 26 /** 27 * Exercise View's disabled state. 28 */ 29 public class Disabled extends Activity implements OnClickListener { 30 @Override onCreate(Bundle icicle)31 protected void onCreate(Bundle icicle) { 32 super.onCreate(icicle); 33 setContentView(R.layout.disabled); 34 35 // Find our buttons 36 Button disabledButton = findViewById(R.id.disabledButton); 37 disabledButton.setEnabled(false); 38 39 // Find our buttons 40 Button disabledButtonA = findViewById(R.id.disabledButtonA); 41 disabledButtonA.setOnClickListener(this); 42 } 43 onClick(View v)44 public void onClick(View v) { 45 Button disabledButtonB = findViewById(R.id.disabledButtonB); 46 disabledButtonB.setEnabled(!disabledButtonB.isEnabled()); 47 } 48 } 49