Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Android Runtime StartActivity requires FLAG_ACTIVITY_NEW_TASK on 4.4 (ART)

$
0
0

I am getting the following exception :-

android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?

When calling StartActivity from another activity on any device running 4.4 with the Android Runtime (ART) enabled. I have the latest stable version of MonoDroid (4.10.1) and the same app deployed to the same devices running 4.4 but using Dalvik works. To recreate I have create a very basic app shown below.

    protected override void OnCreate(Bundle bundle)
    {
        base.OnCreate(bundle);

        SetContentView(Resource.Layout.Main);
        Button button = FindViewById<Button>(Resource.Id.MyButton);
        button.Click += (o, a) => StartActivity(typeof(SecondActivity));
    }

Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>