I am working with xamarin andorid Application.In my application I have some fragments and activitis.How to move from aone fragment to an activity?I have tried StartActivity(typeof(TargetActivity)) but it says ,cannot implicitly convert type 'Type' to Intent. I also tried this
var intent = new Intent(this,typeof(TargetActivity));
StartActivity(intent);
but i got an erro :
Error CS1502: The best overloaded method match for 'Android.Content.Intent.Intent(Android.Content.Context, System.Type)' has some invalid arguments (CS1502) (AndroidApplication)
Error CS1503: Argument 1: cannot convert from 'AndroidApplication.DrawerMenuFragment' to 'Android.Content.Context' (CS1503) (AndroidApplication)
Is you do this from Fragment you have to use Activity
instead of this
as your first argument like so:
var intent = new Intent(Activity,typeof(TargetActivity));
StartActivity(intent);
Move from one fragment to an activity?
var intent = new Intent(this.Activity,typeof(TargetActivity)); StartActivity(intent);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.