I want to execute the login_activity first, then the form_activity like this.
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    // Check Login
    val intent = Intent(this, LoginActivity::class.java)
    startActivity(intent)
    // After login, call FormActivity
    val intent2 = Intent(this, FormActivity::class.java)
    startActivity(intent2)
}
My problem is that if I run this, the app directly opens FormActivity, however, if I comment out the call to FormActivity, then the LoginActivity opens successfully.
What I need is to open the FormActivity only after the LoginActivity returns successfully.
 
     
    