1 /* 2 * Copyright (C) 2011 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 com.example.android.apis.accessibility; 18 19 import android.app.Activity; 20 import android.content.Intent; 21 import android.os.Bundle; 22 import android.provider.Settings; 23 import android.view.View; 24 import android.widget.ImageButton; 25 26 import com.example.android.apis.R; 27 28 /** 29 * This is the entry activity for a sample that demonstrates how to implement an 30 * {@link android.accessibilityservice.AccessibilityService}. 31 */ 32 public class ClockBackActivity extends Activity { 33 34 /** An intent for launching the system settings. */ 35 private static final Intent sSettingsIntent = 36 new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS); 37 38 /** 39 * {@inheritDoc} 40 */ 41 @Override 42 public void onCreate(Bundle savedInstanceState) { 43 super.onCreate(savedInstanceState); 44 setContentView(R.layout.accessibility_service); 45 46 // Add a shortcut to the accessibility settings. 47 ImageButton button = (ImageButton) findViewById(R.id.button); 48 button.setOnClickListener(new View.OnClickListener() { 49 @Override 50 public void onClick(View v) { 51 startActivity(sSettingsIntent); 52 } 53 }); 54 } 55 } 56