Skip to content

Latest commit

 

History

History

SurfaceViewExample

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

SurfaceViewExample - Solution code

The user is presented with a dark surface with a white circle. This represents a wall shone at with a flashlight cone. Touching the surface hides an android image. The light cone then follows continuous motion. If the image of an android is discovered, the screen lights up and the word "WIN!" appears. To restart lift finger and touch screen again.

Introduction

This app demonstrates how to use a SurfaceView to render an image from a separate thread. In addition, it shows how you can use clipping for animation, and implements a basic game loop. This is not intended as a production quality app. Rather, it demonstrates the basics of these techniques, so you can dive deeper on your own.

Pre-requisites

You need to know:

  • Create apps with Android Studio and run them on a mobile device.
  • Create a custom view.
  • Draw on and clip a Canvas.
  • Add event handlers to views.
  • Understand basic threading.

Getting Started

  1. Download and run the app.

License

Copyright 2017 Google, Inc.

Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.