I am using Xamarin and my emulator is performing an error when I click on a TextView that has a link for a phone number.
The application output has this output:
[MessageQueue-JNI] Exception in MessageQueue callback: handleReceiveCallback
[MessageQueue-JNI] android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?
Where do I need to set the flag, and what should I set it to?
May I please have some help to get this working?
Thanks in advance.
EDIT
Here is my application code:
namespace TestTextViewAutoLink
{
[Activity (Label = "TestTextViewAutoLink", MainLauncher = true)]
public class MainActivity : Activity
{
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
TextView textView = new TextView (this.ApplicationContext);
textView.AutoLinkMask = Android.Text.Util.MatchOptions.PhoneNumbers;
textView.Text = "This is a phone number 0800 32 32 32";
//Linkify.AddLinks(textView, MatchOptions.PhoneNumbers);
SetContentView(textView);
}
}
}
Where, in the above code, should I place the Intent flag?
EDIT2
Here is my code to start the activity, with ActivityFlags.NewTask
namespace TestTextViewAutoLink
{
[Activity (Label = "TestTextViewAutoLink", MainLauncher = true)]
public class MainActivity : Activity
{
protected override void OnCreate (Bundle bundle)
{
Intent intent= new Intent(this.ApplicationContext, typeof(AutoLinkActivity));
intent.SetFlags(ActivityFlags.NewTask);
StartActivity(intent);
}
}
}
However, this error now occurs:
android.util.SuperNotCalledException: Activity {TestTextViewAutoLink.TestTextViewAutoLink/testtextviewautolink.MainActivity} did not call through to super.onCreate()
How can I get this code working?