1 /* 2 * Copyright (C) 2006 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; 18 19 import android.content.Context; 20 import android.util.AttributeSet; 21 import android.util.Log; 22 import android.view.MotionEvent; 23 import android.view.KeyEvent; 24 import android.widget.RemoteViews.RemoteView; 25 26 27 /** 28 * <p> 29 * <code>Button</code> represents a push-button widget. Push-buttons can be 30 * pressed, or clicked, by the user to perform an action. A typical use of a 31 * push-button in an activity would be the following: 32 * </p> 33 * 34 * <pre class="prettyprint"> 35 * public class MyActivity extends Activity { 36 * protected void onCreate(Bundle icicle) { 37 * super.onCreate(icicle); 38 * 39 * setContentView(R.layout.content_layout_id); 40 * 41 * final Button button = (Button) findViewById(R.id.button_id); 42 * button.setOnClickListener(new View.OnClickListener() { 43 * public void onClick(View v) { 44 * // Perform action on click 45 * } 46 * }); 47 * } 48 * } 49 * </pre> 50 * 51 * <p><strong>XML attributes</strong></p> 52 * <p> 53 * See {@link android.R.styleable#Button Button Attributes}, 54 * {@link android.R.styleable#TextView TextView Attributes}, 55 * {@link android.R.styleable#View View Attributes} 56 * </p> 57 */ 58 @RemoteView 59 public class Button extends TextView { Button(Context context)60 public Button(Context context) { 61 this(context, null); 62 } 63 Button(Context context, AttributeSet attrs)64 public Button(Context context, AttributeSet attrs) { 65 this(context, attrs, com.android.internal.R.attr.buttonStyle); 66 } 67 Button(Context context, AttributeSet attrs, int defStyle)68 public Button(Context context, AttributeSet attrs, int defStyle) { 69 super(context, attrs, defStyle); 70 } 71 } 72