开始新的活动,当用户点击"返回]从另一项活动用户、QUOT

2023-09-12 22:25:01 作者:我爱的人你别碰i

我有一个在应用程序的启动画面中的活动。 启动画面已经完成(),所以用户不会看到启动画面了,当他们preSS BACK从上保持活动。但是,而不是应用程序直接退出,我希望应用程序显示一个退出闪屏具有不同的图像比启动画面后,该应用程序会直接结束。

I have a splash screen activity at the startup of app. the startup splash screen has finish(), so user will not see startup splash screen anymore when they press BACK from the last remain activity. But instead of app directly exit, I want the app show a exit splash screen which has different images than startup splash screen, after that the app will directly end.

所以,我希望它是这样的: 闪屏1(开始) - >活动A - > b活动 - >(preSS返回) - >显示活动A - >(preSS然后再返回) - >开机画面2(完)

So I want it to be like this : Splash screen 1(Beginning) -> Activity A -> Activity B -> (Press Back) -> Show Activity A -> (Press Back Again) -> Splash screen 2 (End)

如何做到这一点?

我一定要重写后退按钮在活动A或有另一种方法来显示新的活动时,用户preSS回活动的按钮?

Do I have to override back button on Activity A or there's another method to show new activity when user press back button on Activity A ?

推荐答案

你为什么不重写回活动一个按钮启动活动$ C $下飞溅2?我认为这是唯一的解决方案。

Why don't you override back button on Activity A with starting activity code for Splash 2? I think this is the only solution.

例如:

@Override
public void onBackPressed() {
   Intent setIntent = new Intent(ActivityA.this, Splash2.class);
   startActivity(setIntent);
   finish();
}
 
精彩推荐
图片推荐