# Show view over existing view in same activity

I am newbie Android developer, and I am starting out with a simple Sudoku game. The problem I am facing right now is that I have my game showing on a dedicated Activity, which is displaying a custom View class. I have the code within the onDraw function. Now I want to show a custom keypad view, which is a separate class extending View, whenever a user clicks on a block in the Sudoku grid.

I am extremely confused as to how I should go about doing this. I am reluctant to create a dedicated activity for just this keypad, and want to show this keypad over the Sudoku grid view that the activity is currently displaying.

The activity is using setContentView(myCustomGridViewClass) to show the grid. Now I want something to the equivalent of

onTouch -> setContentView(myCustomKeypadView), though this should appear over the previous view.

I have tried reading about the LayoutInflater, but did not understand how to use it to show the keypad within this same activity. This is probably a very noob question, but any help, including any other questions, or sources I could refer to for an answer would be highly appreciated.

Regards,

You could place both views in a FrameLayout or a RelativeLayout and control the keypad's visibility (http://developer.android.com/reference/android/view/View.html#setVisibility(int)) when needed.