关闭Android应用程序?应用程序、Android

2023-09-12 23:44:44 作者:他拾裏鰅妳

我想知道如何将在Android的应用程序。 其实我用的完成()方法中,我们可以关闭present活动有想法.. 但我要的是,以下code定义其余...

Hi i want to know how to close an application in Android. Actually i am having idea by using the finish() method we can close present activity.. But what i want is, the following code defines remaining...

Main.java

Main.java

   Handler handle=new Handler();

    handle.postDelayed(new Runnable() {

        @Override
        public void run() {
            // TODO Auto-generated method stub
            startActivity(new  Intent(ZzzzzProjActivity.this,Second.class));
        }
    }, 3000);

Second.java

Second.java

/*** same above code***/

Third.java

Third.java

   @Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    // TODO Auto-generated method stub
    if(keyCode == KeyEvent.KEYCODE_BACK)
    {
        Toast.makeText(getApplicationContext(), "backbutton", 30).show();
        finish();

    }
    return super.onKeyDown(keyCode, event);

}

按照以下code来Third.java后,当我点击后退按钮是导航回Second.java页面。但是,我想是我的应用程序需要关闭完全。任何人都可以帮我这个....

As per the following code after coming to Third.java, when i click back button it is navigating back to Second.java page. But what i want is my applications needs to close totally. Can anyone help me with this....

推荐答案

有关Achive,你应该完成的时候,你从现在却只拜访另一个活动,当你调用从第一个second.class你要完成第一个像现在的活动等等...

for Achive that you should finish the current Activity when you call another Activity from Current one, like when you call second.class from first one you should finish first one and so on...,

也就是说,当你调用另一个activity.class那么你就应该用

i.e when you call another activity.class then you should finish the currentActivity.class by

喜欢

CurrentActivity.this.finish();

CurrentActivity.this.finish();