Android getting RESULT_CANCELED when I specifically add RESULT_OK

前端 未结 3 1180
醉梦人生
醉梦人生 2020-12-18 19:22

This is my problem, I have the main view which only shows one button, pressing this button another view is shown. This view has only another button, when this button is push

3条回答
  •  遥遥无期
    2020-12-18 19:33

    here,

    @Override
    public void onBackPressed() {
        setResult(Activity.RESULT_OK);
        finish();
    }
    

    does work to return(RESULT_OK) by pressing the BACK button. Do NOT call

    super.onBackPressed().

提交回复
热议问题