android key event problem
<p>I have a parent ScrollView with a child view. When the user presses the back button, I want the child view to handle the event. I have tried a couple of things but none of them seem to work. pressing the back button kill sthe activity.</p>

<pre><code>public class GameScrollView extends ScrollView{

     public GameScrollView(Context context) {
          super(context);
     }
     @Override
     public boolean onInterceptTouchEvent (MotionEvent ev){
          return false;

     }
     @Override
     public boolean onKeyDown (int keyCode, KeyEvent event){
          return false;

     }
}
</code></pre>

<p>in the child view I have the following code</p>

<pre><code>public class GameView extends View implements OnTouchListener, onKeyListener{

     public boolean onKey(View v, int keyCode, KeyEvent event){
          if(keyCode == KeyEvent.KEYCODE_BACK){
                    //do stuff
          }
          invalidate();
          return true;        
     }
}
</code></pre>

<p>In the ScrollView I have also tried overriding the dispatchKeyEvent method to return false, but that did not work either. What am I doing wrong here?</p>

<p>Thanks!</p>
