刚刚开始使用 Android 进行开发。
我们是否希望 MainActivity 包含任何类型的用户界面?前任。它应该向用户提供登录选项还是其他什么?或者 MainActivity 应该只在应用程序启动时执行指令,然后重定向到另一个 java 文件,该文件将向用户展示他/她看到的第一件事?
如果是后者,一旦应用程序启动时执行了所有内容,如何使 MainActivity 重定向到另一个 java 文件?就像自动一样,无需单击按钮或任何其他操作。
谢谢,抱歉,但我是新手
编辑: 有没有类似 iOS 应用委托(delegate)的东西?
最佳答案
Should it present the user with a login option or whatever?
Activity
的主要作用是向用户呈现用户界面。无论是“登录选项还是其他选项”都取决于您。
Or should MainActivity just have instructions to be executed at the apps launch, and then redirect to another java file that will present the user with the first thing s/he sees?
这不是常见的模式。
how can I make MainActivity redirect to another java file once everything is executed upon the apps launch?
调用 startActivity()
启动另一个 Activity,然后调用 finish()
删除您所在的 Activity。
关于java - 基础 Android - MainActivity 的目的,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24563896/