I’ve got a Activty which is displayed after a info-button is pressed. Now I want to close/ destroy the activty, when the user touches the screen, so that the user can get back to the main-activty again, without pressing the back-button of the device. How does the code look like.
I tried this, but it has no effect:
if(onTouchEvent(null)){
finish();
}
Thanks.
EDIT:
This is the whole code I have:
public class InfoDialog extends Activity{
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.info_dialog); }
I use this Class just to show a short Information about the App with in the android-style of Theme.Dialog
However, I want to add one function, to destroy/ close this activty, when the touchscreen is pressed, so that there is no need to press the back-button.
Try this…