gpt4 book ai didi

android - 如何转到android studio上的下一个随机 Activity ?

转载 作者:行者123 更新时间:2023-11-29 15:49:26 26 4
gpt4 key购买 nike

How can I go to the next activity in random for example, on the first activity there is a button which will go to the 2nd, 3rd or 4th activity.when one of the 3 is selected how can I go to the next 2 随机?然后当它完成时,它将再次返回到第一个 Activity 。请帮忙,我所知道的只是“Intent ”,它只会进行特定的 Activity 。

最佳答案

类似的东西

Class[] classes = new Class[3];
classes[0] = Activity0.class;
classes[1] = Activity1.class;
classes[2] = Activity2.class;
Random r = new Random();

Intent i = new Intent(this, classes[r.nextInt(classes.length)]);
startActivity(i);

关于android - 如何转到android studio上的下一个随机 Activity ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31185871/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com