title: Changing Screen background color by touch
body: <p>I am new to Android development and my requirement is when the App starts, a blank screen is displayed. When the user swipes the screen, the Background color should change.</p>
  
  <p>I don´t know how to implement this. Below is what I have so far.</p>
  
  <pre><code>import android.os.Bundle;
      import android.app.Activity;
      import android.graphics.Color;
      import android.view.GestureDetector;
      import android.view.GestureDetector.OnGestureListener;
      import android.view.Menu;
      import android.view.MotionEvent;
      import android.widget.LinearLayout;
      import android.widget.TextView;
  
      public class MainActivity extends Activity implements OnGestureListener {    
          private LinearLayout main;    
          private TextView viewA;
  
          private GestureDetector gestureScanner;
  
          @Override
          public boolean onTouchEvent(MotionEvent me) {
              return gestureScanner.onTouchEvent(me);
  
          }
  
          @Override
          public void onCreate(Bundle savedInstanceState) {
              super.onCreate(savedInstanceState);
          }
  
          @Override
          public boolean onDown(MotionEvent e) {
              viewA.setText("-" + "DOWN" + "-");
              return true;
          }
  
          @Override
          public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
              viewA.setText("-" + "FLING" + "-");
              return true;
          }
  
          @Override
          public void onLongPress(MotionEvent e) {
              viewA.setText("-" + "LONG PRESS" + "-");
          }
  
          @Override
          public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
              viewA.setText("-" + "SCROLL" + "-");
              return true;
          }
  
          @Override
          public void onShowPress(MotionEvent e) {
              viewA.setText("-" + "SHOW PRESS" + "-");
          }    
  
          @Override
          public boolean onSingleTapUp(MotionEvent e) {
              viewA.setText("-" + "SINGLE TAP UP" + "-");
              return true;
          }
  
          public LinearLayout getMain() {
              return main;
          }
  
          public void setMain(LinearLayout main) {
              this.main = main;
          }
  
      }
  </code></pre>