This happens on the MainActivity when i call a button click event.
public class MainActivity : AppCompatActivity
{
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
// Set our view from the "main" layout resource SetContentView(Resource.Layout.activity_main); Button btnLogin = this.FindViewById<Button>(Resource.Id.btnGotoLogin); btnLogin.Click += (object sender, EventArgs e) => { Intent intent = new Intent(this, typeof(LoginActivity)); StartActivity(intent); }; Button btnRegister = this.FindViewById<Button>(Resource.Id.btnGotoReg2); btnRegister.Click += (object sender, EventArgs e) => { Intent intent = new Intent(this, typeof(RegisterActivity)); StartActivity(intent); }; } }
Answers
@ndzalama Can you explain more. I think LoginActivity and RegisterActivity to be set as Activity like below .
[Activity(Label = "LoginActivity", MainLauncher = false, Theme = "@style/MyTheme")]
public class LoginActivity : AppCompatActivity
Theme is optional.
@ndzalama
There may be something wrong with the code in LoginActivity or RegisterActivity?
Which activity occured the error when calling
StartActivity()
. Please post the code of the activity.