Go back / finish function directly in called onClick, without further code

StackOverflow https://stackoverflow.com/questions/23520804

  •  17-07-2023
  •  | 
  •  

سؤال

I know I can have something like:

<ImageView
    android:id="@+id/zoomImage"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:clickable="true"
    android:onClick="goBack"
    android:src="@drawable/zoom_selector" />

and then a function like

public void goBack(View v){
    finish();
}

but I was wondering if there is any key/reserved word to do exactly that, without having to create my own function. Something like

android:onClick="reservedWordThatFinishesTheCurrentActivity"

I´m curious about it. :)

هل كانت مفيدة؟

المحلول

Seems like there is no way to do so and, therefore, I will carry on with my life, as suggested in one of the comments.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top