Android的:如何模拟后退按钮按钮、Android

由网友(无敌小萝莉)分享简介:目前我的活动允许用户填写了某些数据。其中包括微调等。当用户点击一次系统导航到另一个屏幕。当我preSS后退按钮上的电话previous活动加载,填补数据可用。 Currently my activity allows users to fill up certain data. Including spinner e...

目前我的活动允许用户填写了某些数据。其中包括微调等。当用户点击一次系统导航到另一个屏幕。当我preSS后退按钮上的电话previous活动加载,填补数据可用。

Currently my activity allows users to fill up certain data. Including spinner etc. When user click next system navigates to another screen. When I press back button on the phone previous activity loaded and filled data is available.

我的要求,要求我给柔和的后退按钮,在UI。当用户点击它它navigats回previous屏幕,但填充数据不可用。

My requirement asks me to give a soft "Back" button in the UI. When user clicks it it navigats back to previous screen but the filled data is not available.

有什么方法来模拟软UI按钮onclick事件?

Is there any way to simulate the back button on a soft UI button onclick event??

Intent back = new Intent(ImagePreviewActivity.this, sendingpage.class);
startActivity(back);

在此先感谢您的时间。

Thanks in advance for your time.

推荐答案

您只好打电话给你的活动 完成()当用户点击软后退按钮的方法。

You'll just have to call your Activity finish() method when the user clicks the soft back button.

编辑:只是让你的活动实施 OnClickListener ,然后在code

just let your Activity implement OnClickListener and then in code

          myBackButton.setOnClickListener(this);
   ....

   public void onClick(View v) {
       if(v.getId()==R.id.YourBackButton){
           finish();
       }
   }

EDIT2 :您也可以拨打 onBack pressed()活动

EDIT2: you can also call onBackPressed() from your Activity.

阅读全文

相关推荐

最新文章