窗口/应用程序启动后,如何获得自动运行的命令?

因此,我创建了具有多个屏幕的基本骰子滚动应用程序。 我的主屏幕是一个骰子猜测屏幕,用户在其中输入一个猜测,掷骰子并可以查看他们的猜测是否正确。 我遇到的麻烦是;我使用了一个按钮来打开新屏幕并运行其他课程。 但是,在此屏幕中,我需要在屏幕打开后立即显示一个随机问题(可能是6个问题),而无需用户输入。 新屏幕可以正常工作并打开,什么也没显示

任何有关如何实现这一目标的想法将不胜感激。 抱歉,如果我的代码混乱或效率低下,我是新手,这就是我对atm的理解 谢谢:)

int number;

 public void ice (View view)
    {
        Random randomer = new Random(); //replaces old random number
        number = randomer.nextInt(6) + 1; // sets lower bound of 1 and upper bound of 6,cannot be 0 as dice have no Zero's

        String feedback = ""; //the "feedback" is empty in order to produce a "right" or "wrong" output later when answer is input and compared to dice

        switch (number)
        {
            case 1:
            {
                feedback = "If you could go anywhere in the world,where would you go?"; 
            }
            case 2:
            {
                feedback = "If you were stranded on a desert island,what three things would you want to take with you?";  this
            }
            case 3:
            {
                feedback = "If you could eat only one food for the rest of your life,what would that be?"; 
            }
            case 4:
            {
                feedback = "If you won a million dollars,what is the first thing you would buy?"; 
            }
            case 5:
            {
                feedback = "If you could spaned the day with one fictional character,who would it be?"; 
            }
            case 6:
            {
                feedback = "If you found a magic lantern and a genie gave you three wishes,what would you wish?"; 
            }
        }
    }
mm00ll 回答:窗口/应用程序启动后,如何获得自动运行的命令?

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3140427.html

大家都在问