protected override void OnCreate (Bundle bundle) { SetTitle(Resource.String.reportcollecting); var path = Environment.GetFolderPath (Environment.SpecialFolder.Personal); _filepath = Path.Combine (path, "CallSlips.txt"); base.OnCreate (bundle); //ShowAlert (); var prefs = Application.Context.GetSharedPreferences("Violadev", FileCreationMode.Private); _isLoggedIn = prefs.GetBoolean("Authorized", false); if (_isLoggedIn) { PostReport(); } else { var loginActivity = new Intent(this, typeof(LogIn)); loginActivity.AddFlags(ActivityFlags.ClearTop); loginActivity.AddFlags(ActivityFlags.NewTask); loginActivity.AddFlags(ActivityFlags.ClearTask); StartActivity(loginActivity); } // Create your application here }
public void InstallAPK_MoreThanAndroid7(Java.IO.File apkFileToInstall) { Android.Content.Intent intent = new Android.Content.Intent(); intent.SetAction(Android.Content.Intent.ActionView); if (string.IsNullOrWhiteSpace(mFileProvider_Authority)) { throw new Exception("mFileProvider_Authority为空值。请使用 SetFileProvider_Authority(string) 方法设置 mFileProvider_Authority 的值。"); } Android.Net.Uri uri = Android.Support.V4.Content.FileProvider.GetUriForFile ( context: mAppActivity.ApplicationContext, authority: mFileProvider_Authority, file: apkFileToInstall ); intent.SetDataAndType(uri, "application/vnd.android.package-archive"); intent.SetFlags(Android.Content.ActivityFlags.NewTask); // SetFlags 一定要在 Add Flags 之前, 否则 Add Flags 会被覆盖 intent.AddFlags(Android.Content.ActivityFlags.GrantReadUriPermission); intent.AddFlags(Android.Content.ActivityFlags.GrantWriteUriPermission); mAppActivity.Application.StartActivity(intent); }
// Returns a new intent to start NewDocumentActivity as a new document in recents private Intent NewDocumentIntent() { var intent = new Intent (this, Java.Lang.Class.FromType (typeof(NewDocumentActivity))); intent.AddFlags (ActivityFlags.NewDocument); intent.AddFlags (ActivityFlags.MultipleTask); return intent; }
public override bool OnOptionsItemSelected (IMenuItem item) { Log.Debug (Tag, "Item {0} has been selected.", item.Order); if (item.ItemId == Android.Resource.Id.Home || item.ItemId == 0) { return false; } var intent = new Intent (); switch (item.Order) { case 1: intent.SetClass (this, typeof(MainActivity)); intent.AddFlags (ActivityFlags.ClearTop); // http://developer.android.com/reference/android/content/Intent.html#FLAG_ACTIVITY_CLEAR_TOP StartActivity (intent); break; case 2: intent.SetClass (this, typeof(SpeakersActivity)); intent.AddFlags (ActivityFlags.ClearTop); // http://developer.android.com/reference/android/content/Intent.html#FLAG_ACTIVITY_CLEAR_TOP StartActivity (intent); break; case 3: intent.SetClass (this, typeof(SessionsActivity)); intent.AddFlags (ActivityFlags.ClearTop); // http://developer.android.com/reference/android/content/Intent.html#FLAG_ACTIVITY_CLEAR_TOP StartActivity (intent); break; } return true; }
protected override void OnMessage (Context context, Intent intent) { //Push Notification arrived - print out the keys/values Intent received = new Intent (context, typeof(RecievedPush)); string pushMessage = intent.GetStringExtra ("message"); received.AddFlags (ActivityFlags.ReorderToFront); received.AddFlags (ActivityFlags.NewTask); received.PutExtra ("pushedMessage", pushMessage); if (intent == null || intent.Extras == null) { received.PutExtras (intent.Extras); foreach (var key in intent.Extras.KeySet()) { Console.WriteLine ("Key: {0}, Value: {1}"); } } PendingIntent notificationLaunch = PendingIntent.GetActivity (context, 1000, received, PendingIntentFlags.CancelCurrent ); NotificationManager manager = (NotificationManager)GetSystemService (Context.NotificationService); NotificationCompat.Builder builder = new NotificationCompat.Builder (context); builder.SetContentText (pushMessage); builder.SetContentIntent ( notificationLaunch); builder.SetContentTitle ("New Message"); builder.SetSmallIcon (Resource.Drawable.ic_action_chat); builder.SetStyle ( new NotificationCompat.InboxStyle()); builder.SetSound (RingtoneManager.GetDefaultUri (RingtoneType.Notification)); builder.SetVibrate (new long[] { 500, 300, 100, 1000, 300, 300, 300 ,300 }); manager.Notify (1000, builder.Build ()); Buddy.RecordNotificationReceived(intent); }
public void AddHomeAction() { var homeIntent = new Intent(this, typeof(HomeActivity)); homeIntent.AddFlags(ActivityFlags.ClearTop); homeIntent.AddFlags(ActivityFlags.NewTask); ActionBar.SetHomeAction(new MyActionBarAction(this, homeIntent, Resource.Drawable.ic_launcher)); ActionBar.SetDisplayHomeAsUpEnabled(true); }
public void HandleButtonRapporteraCallSlips(object sender, EventArgs e) { var reportFetchActivity = new Intent(this, typeof(ReportFetched)); reportFetchActivity.AddFlags(ActivityFlags.ClearTop); reportFetchActivity.AddFlags(ActivityFlags.NewTask); reportFetchActivity.AddFlags(ActivityFlags.ClearTask); StartActivity(reportFetchActivity); }
public void AddHomeAction(Type activity, int resId) { var homeIntent = new Intent(this, activity); homeIntent.AddFlags(ActivityFlags.ClearTop); homeIntent.AddFlags(ActivityFlags.NewTask); LegacyBar.SetHomeAction(new DefaultLegacyBarAction(this, homeIntent, resId)); LegacyBar.SetDisplayHomeAsUpEnabled(true); }
//samma som fethCallSlip från menu //Fetch CallSlips from Viola public void HandleButtonfetchNewCallSlips(object sender, EventArgs e) { string path = Environment.GetFolderPath(Environment.SpecialFolder.Personal); _filepath = Path.Combine(path, "CallSlips.txt"); File.Delete(_filepath); var fetchCallSlipsActivity = new Intent(this, typeof(FetchCallSlips)); fetchCallSlipsActivity.AddFlags(ActivityFlags.ClearTop); fetchCallSlipsActivity.AddFlags(ActivityFlags.NewTask); fetchCallSlipsActivity.AddFlags(ActivityFlags.ClearTask); StartActivity(fetchCallSlipsActivity); }
public override void OnReceive(Context context, Intent intent) { #if TOMIC_ANDROID if (intent.Action == Intent.ActionBootCompleted) { Intent activity = new Intent(context, typeof(SplashActivity)); activity.AddFlags(ActivityFlags.NewTask); activity.AddFlags(ActivityFlags.SingleTop); context.StartActivity(activity); } #endif }
protected override void OnCreate (Android.OS.Bundle savedInstanceState) { base.OnCreate (savedInstanceState); SetContentView (Resource.Layout.activity_order_complete); mFullWallet = Intent.GetParcelableExtra (Constants.EXTRA_FULL_WALLET).JavaCast<FullWallet> (); var continueButton = FindViewById<Button> (Resource.Id.button_continue_shopping); continueButton.Click += delegate { var intent = new Intent (this, typeof (ItemListActivity)); intent.AddFlags (ActivityFlags.ClearTask); intent.AddFlags (ActivityFlags.NewTask); StartActivity (intent); }; }
//Fetch CallSlips from CallSlips.txt file public void HandleButtonFetchCallSlipsFromFile(object sender, EventArgs e) { if (System.IO.File.Exists(_filepath) && _filepath != null) { var fetchCallSlipsActivity = new Intent(this, typeof(FetchCallSlips)); fetchCallSlipsActivity.AddFlags(ActivityFlags.ClearTop); fetchCallSlipsActivity.AddFlags(ActivityFlags.NewTask); fetchCallSlipsActivity.AddFlags(ActivityFlags.ClearTask); StartActivity(fetchCallSlipsActivity); } else { Toast.MakeText(this, "Inga icke rapporterad lista", ToastLength.Long).Show(); } }
public override bool OnOptionsItemSelected(Android.Views.IMenuItem item) { switch (item.ItemId) { case Android.Resource.Id.Home: // app icon in action bar clicked; go home var intent = new Intent(this, typeof(DialogActivity)); intent.AddFlags(ActivityFlags.ClearTop); intent.AddFlags(ActivityFlags.NewTask); StartActivity(intent); return true; default: return base.OnOptionsItemSelected(item); } }
void ProcessHttpRequest(HttpListenerContext context) { try { string barcodeFormatStr = context.Request?.QueryString? ["format"] ?? "QR_CODE"; string barcodeValue = context?.Request?.QueryString? ["value"] ?? ""; string barcodeUrl = context?.Request?.QueryString? ["url"] ?? ""; // Pass along the querystring values var intent = new Android.Content.Intent(this, typeof(MainActivity)); intent.PutExtra("FORMAT", barcodeFormatStr); intent.PutExtra("VALUE", barcodeValue); intent.PutExtra("URL", barcodeUrl); intent.AddFlags(ActivityFlags.NewTask); // Start the activity to show the values StartActivity(intent); // Return a success context.Response.StatusCode = (int)HttpStatusCode.OK; context.Response.StatusDescription = "OK"; context.Response.Close(); } catch (Exception e) { Console.WriteLine("Error " + e.Message); context.Response.StatusCode = (int)HttpStatusCode.InternalServerError; context.Response.Close(); } }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Page_Dialog); var yesNoDialogbutton = FindViewById<Button>(Resource.Id.YesNoDialogButton); yesNoDialogbutton.Click += delegate { var builder = new AlertDialog.Builder(this); builder.SetMessage(Resource.String.knigts_dialog_title); builder.SetPositiveButton(Resource.String.yes, (s, e) => { }); builder.SetNegativeButton(Resource.String.no, (s, e) => { }).Create(); builder.Show(); }; var alertDialogButton = FindViewById<Button>(Resource.Id.AlertDialogButton); alertDialogButton.Click += delegate { ShowDialog(AlertDialog); }; var listDialogButton = FindViewById<Button>(Resource.Id.ListDialogButton); listDialogButton.Click += delegate { ShowDialog(ListDialog); }; var multiChoiceDialogButton = FindViewById<Button>(Resource.Id.MultiChoiceDialogButton); multiChoiceDialogButton.Click += delegate { ShowDialog(MultiChoiceDialog); }; var customViewDialogButton = FindViewById<Button>(Resource.Id.CustomViewDialogButton); customViewDialogButton.Click += delegate { ShowDialog(CustomViewDialog); }; var fragmentDialogsButton = FindViewById<Button>(Resource.Id.FragmentDialogsButton); fragmentDialogsButton.Click += delegate { var intent = new Intent(this, typeof (DialogFragmentActivity)); intent.AddFlags(ActivityFlags.ClearTop); StartActivity(intent); }; }
private void SendNotification (Bundle data) { Intent intent; string type = data.GetString("type"); intent = new Intent (this, typeof(MainActivity)); if(type.Equals(PUSH_INVITE)) { ViewController.getInstance().pushEventId = Convert.ToInt32(data.GetString("eventId")); intent.SetAction(PUSH_INVITE); } else if(type.Equals(PUSH_EVENT_UPDATE)) { ViewController.getInstance().pushEventId = Convert.ToInt32(data.GetString("eventId")); intent.SetAction(PUSH_EVENT_UPDATE); } else if(type.Equals(PUSH_DELETE)) { //nothing else need to be done //MainActivity will refresh the events on start } intent.AddFlags (ActivityFlags.ClearTop); var pendingIntent = PendingIntent.GetActivity (this, 0, intent, PendingIntentFlags.OneShot); var notificationBuilder = new Notification.Builder(this) .SetSmallIcon (Resource.Drawable.pushnotification_icon) .SetContentTitle (data.GetString("title")) .SetContentText (data.GetString ("message")) .SetVibrate(new long[] {600, 600}) .SetAutoCancel (true) .SetContentIntent (pendingIntent); var notificationManager = (NotificationManager)GetSystemService(Context.NotificationService); notificationManager.Notify (notificationId, notificationBuilder.Build()); notificationId++; }
private void CheckGpsAvailable() { bool gpsAvailable = DependencyService.Get <IGpsService>().IsGpsAvailable(); if (!gpsAvailable) { AlertDialog.Builder alert = new AlertDialog.Builder(this).SetCancelable(false); alert.SetPositiveButton(Resources.GetText(Resource.String.Common_Yes), (senderAlert, args) => { //DependencyService.Get<IGpsService>().OpenSettings(this); Intent intent = new Android.Content.Intent(Android.Provider.Settings.ActionLocationSourceSettings); intent.AddFlags(ActivityFlags.BroughtToFront); StartActivityForResult(intent, REQUEST_GPS_SETTINGS); }); alert.SetNegativeButton(Resources.GetText(Resource.String.Common_No), (senderAlert, args) => { StartMainActivity(); }); alert.SetMessage(Resources.GetText(Resource.String.Main_EnableGpsQuestion)); var answer = alert.Show(); } else { StartMainActivity(); } }
public void SaveComplete() { Toast.MakeText(this, "Save Successful", ToastLength.Short).Show(); var i = new Intent(this, typeof (ItemListActivity)); i.AddFlags(ActivityFlags.ClearTop); StartActivity(i); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { var rootView = inflater.Inflate(Resource.Layout.FragmentSectionLaunchpad, container, false); var demoCollectionBtn = rootView.FindViewById<Button>(Resource.Id.DemoCollectionButton); // Demonstration of a collection-browsing activity. demoCollectionBtn.Click += delegate { var intent = new Intent(this.Activity, typeof(CollectionDemoActivity)); this.StartActivity(intent); }; var demoListNavBtn = rootView.FindViewById<Button>(Resource.Id.DemoListNavButton); demoListNavBtn.Click += delegate { var intent = new Intent(this.Activity, typeof(ListNavigationActivity)); this.StartActivity(intent); }; var externalActivityBtn = rootView.FindViewById<Button>(Resource.Id.DemoExternalActivityButton); // Demonstration of navigating to external activities. externalActivityBtn.Click += delegate { // Create an intent that asks the user to pick a photo, but using // FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET, ensures that relaunching // the application from the device home screen does not return // to the external activity. var externalActivityIntent = new Intent(Intent.ActionPick); externalActivityIntent.SetType("image/*"); externalActivityIntent.AddFlags(ActivityFlags.ClearWhenTaskReset); this.StartActivity(externalActivityIntent); }; return rootView; }
public override bool OnOptionsItemSelected(IMenuItem item) { switch (item.ItemId) { case global::Android.Resource.Id.Home: new AlertDialog.Builder(this) .SetTitle ("Cancel") .SetMessage ("Are you sure you want to cancel your message?") .SetPositiveButton ("Yes", (o, e) => { var homeIntent = new Intent(); homeIntent.PutExtra ("defaultTab", 1); homeIntent.AddFlags (ActivityFlags.ClearTop); homeIntent.SetClass (this, typeof(MainActivity)); StartActivity(homeIntent); }) .SetNegativeButton ("No", (o, e) => { }) .Show (); break; case Resource.Id.menuCancelMessage: new AlertDialog.Builder(this) .SetTitle ("Cancel") .SetMessage ("Are you sure you want to cancel your message?") .SetPositiveButton ("Yes", (o, e) => { var homeIntent = new Intent(); homeIntent.PutExtra ("defaultTab", 1); homeIntent.AddFlags (ActivityFlags.ClearTop); homeIntent.SetClass (this, typeof(MainActivity)); StartActivity(homeIntent); }) .SetNegativeButton ("No", (o, e) => { }) .Show (); break; } return true; }
private void initTabs () { TabHost.TabSpec spec; // Resusable TabSpec for each tab Intent intent; // Reusable Intent for each tab // Tab with of tournaments the user can sign up for intent = new Intent (this, typeof (TournamentOpen)); intent.AddFlags (ActivityFlags.NewTask); spec = TabHost.NewTabSpec ("Open toernooien"); spec.SetIndicator ("Open toernooien"); spec.SetContent (intent); TabHost.AddTab (spec); // Tab with list of tournament which are currently running and the user is signed up for intent = new Intent (this, typeof (TournamentActive)); intent.AddFlags (ActivityFlags.NewTask); spec = TabHost.NewTabSpec ("Actieve toernooien"); spec.SetIndicator ("Actieve toernooien"); spec.SetContent (intent); TabHost.AddTab (spec); // Tab with list of finished tournament intent = new Intent (this, typeof (TournamentsFinished)); intent.AddFlags (ActivityFlags.NewTask); spec = TabHost.NewTabSpec ("Afgelopen toernooien"); spec.SetIndicator ("Afgelopen toernooien"); spec.SetContent (intent); TabHost.AddTab (spec); }
public override void ScanContinuously (MobileBarcodeScanningOptions options, Action<Result> scanHandler) { var scanIntent = new Intent(lifecycleListener.Context, typeof(ZxingActivity)); scanIntent.AddFlags(ActivityFlags.NewTask); ZxingActivity.UseCustomOverlayView = this.UseCustomOverlay; ZxingActivity.CustomOverlayView = this.CustomOverlay; ZxingActivity.ScanningOptions = options; ZxingActivity.ScanContinuously = true; ZxingActivity.TopText = TopText; ZxingActivity.BottomText = BottomText; ZxingActivity.OnCanceled += () => { ZxingActivity.RequestCancel (); }; ZxingActivity.OnScanCompleted += (Result result) => { if (scanHandler != null) scanHandler (result); }; lifecycleListener.Context.StartActivity(scanIntent); }
public override void OnReceive(Context context, Intent intent) { // Log.Info(Tag, "Intent received: " + intent.Action); // read the SendBroadcast data if (intent.Action == "com.alr.text") { string text = intent.GetStringExtra("MyData") ?? "Data not available"; Toast.MakeText(context, text, ToastLength.Short).Show(); Intent intents = new Intent(context, typeof(MainActivity)); intents.AddFlags(ActivityFlags.NewTask); context.StartActivity(intents); } //read incomming sms if (intent.Action == IntentAction) { SmsMessage[] messages = Telephony.Sms.Intents.GetMessagesFromIntent(intent); var sb = new StringBuilder(); for (var i = 0; i < messages.Length; i++) { sb.Append(string.Format("SMS From: {0}{1}Body: {2}{1}", messages[i].OriginatingAddress, System.Environment.NewLine, messages[i].MessageBody)); } Toast.MakeText(context, sb.ToString(), ToastLength.Short).Show(); } }
void ProcessHttpRequest (HttpListenerContext context) { try { string barcodeFormatStr = context.Request?.QueryString? ["format"] ?? "QR_CODE"; string barcodeValue = context?.Request?.QueryString? ["value"] ?? ""; string barcodeUrl = context?.Request?.QueryString? ["url"] ?? ""; // Pass along the querystring values var intent = new Android.Content.Intent (this, typeof (MainActivity)); intent.PutExtra ("FORMAT", barcodeFormatStr); intent.PutExtra ("VALUE", barcodeValue); intent.PutExtra ("URL", barcodeUrl); intent.AddFlags (ActivityFlags.NewTask); // Start the activity to show the values StartActivity (intent); // Return a success context.Response.StatusCode = (int)HttpStatusCode.OK; context.Response.StatusDescription = "OK"; context.Response.Close (); } catch (Exception e) { Console.WriteLine ("Error " + e.Message); context.Response.StatusCode = (int)HttpStatusCode.InternalServerError; context.Response.Close (); } }
protected override void OnCreate (Bundle bundle) { base.OnCreate (bundle); // Set our view from the "main" layout resource SetContentView (Resource.Layout.Main);//Main TabHost tabHost = FindViewById<TabHost> (Resource.Id.tabHost); tabHost.Setup (this.LocalActivityManager); TabHost.TabSpec tabSpec1 = tabHost.NewTabSpec ("Contacts"); TabHost.TabSpec tabSpec2 = tabHost.NewTabSpec ("Settings"); Intent intent; tabSpec1.SetIndicator ("Contacts"); intent = new Intent (this, typeof(ContactsActivity)); intent.AddFlags (ActivityFlags.NewTask); tabSpec1.SetContent (intent); tabSpec2.SetIndicator ("Settings"); intent = new Intent (this, typeof(SettingsActivity)); intent.AddFlags (ActivityFlags.NewTask); tabSpec2.SetContent (intent); tabHost.AddTab (tabSpec1); tabHost.AddTab (tabSpec2); tabHost.CurrentTab = 0; intent = new Intent (this, typeof(LoginActivity)); StartActivity (intent); }
public override View GetView (Context context, View convertView, ViewGroup parent) { View view = base.GetView (context, convertView, parent); view.Click += delegate { if (TestCase.RunState != RunState.Runnable) return; AndroidRunner runner = AndroidRunner.Runner; if (!runner.OpenWriter ("Run " + TestCase.FullName, context)) return; try { //Test.Run (runner); runner.Run (TestCase); } finally { runner.CloseWriter (); } if (Result.ResultState.Status != TestStatus.Passed) { Intent intent = new Intent (context, typeof(TestResultActivity)); intent.PutExtra ("TestCase", Name); intent.AddFlags (ActivityFlags.NewTask); context.StartActivity (intent); } }; return view; }
void LiveClick(object sender, EventArgs e) { Intent i = new Intent(); i.SetClass(this, typeof(Start)); i.AddFlags(ActivityFlags.NewTask); StartActivity(i); }
/// <summary> /// Activitie's create event handeler. /// </summary> protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Create managers and register references MgrAccessor.RegisterReference<IFileEntryManager>(new FileEntryManager()); MgrAccessor.RegisterReference<ICommonUtils>(new CommonUtils()); MgrAccessor.RegisterReference<IDiskUtils>(new DiskUtils()); #if DEBUG // Create test data MgrAccessor.DiskUtils.CreateTestData(); #endif SetContentView(Resource.Layout.Home); // Create FileEntryList tab var intent = new Intent(this, typeof(FileEntryListActivity)); intent.AddFlags(ActivityFlags.NewTask); var spec = TabHost.NewTabSpec("Explorer"); spec.SetIndicator("", Resources.GetDrawable(Resource.Drawable.ic_tab_explorer)); spec.SetContent(intent); TabHost.AddTab(spec); // Create About tab intent = new Intent(this, typeof(AboutActivity)); intent.AddFlags(ActivityFlags.NewTask); spec = TabHost.NewTabSpec("About"); spec.SetIndicator("", Resources.GetDrawable(Resource.Drawable.ic_tab_about)); spec.SetContent(intent); TabHost.AddTab(spec); TabHost.CurrentTab = 0; }
/// <summary> /// method to load the viewer's view /// </summary> private void loadSpectate() { Intent i = new Intent(); i.SetClass(this, typeof(Spectate)); i.AddFlags(ActivityFlags.NewTask); StartActivity(i); }
void OpenUrl(Context context) { Intent intent = new Intent(context, typeof(HtmlActivity)); intent.PutExtra("URL", this.Url.ToString()); intent.AddFlags(ActivityFlags.NewTask); context.StartActivity(intent); }
public override bool OnOptionsItemSelected(IMenuItem item) { if (_drawerToggle.OnOptionsItemSelected(item)) return true; switch (item.ItemId) { case Resource.Id.action_websearch: { var intent = new Intent(Intent.ActionWebSearch); intent.PutExtra(SearchManager.Query, ActionBar.Title); if ((intent.ResolveActivity(PackageManager)) != null) StartActivity(intent); else Toast.MakeText(this, Resource.String.app_not_available, ToastLength.Long).Show(); return true; } case Resource.Id.action_slidingpane: { var intent = new Intent(this, typeof(SlidingPaneLayoutActivity)); intent.AddFlags(ActivityFlags.ClearTop); StartActivity(intent); return true; } default: return base.OnOptionsItemSelected(item); } }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Use this to return your custom view for this Fragment var view = inflater.Inflate(Resource.Layout.HeaderFragmentLayout, container, false); var homeBtn = view.FindViewById<ImageView>(Resource.Id.HeaderLogo); var overlayBtn = view.FindViewById<ImageView>(Resource.Id.HeaderOverlay); var animIn = AnimationUtils.LoadAnimation(Activity.BaseContext, Resource.Animation.Overlay_animIn); homeBtn.Click += delegate { if (!(Activity is MainActivity)) { var i = new Intent(Activity, typeof(MainActivity)); i.AddFlags(ActivityFlags.NewTask | ActivityFlags.ClearTop); Activity.StartActivity(i); } }; overlayBtn.Click += delegate { overlay.View.StartAnimation(animIn); overlay.Initialize(); overlay.View.Visibility = ViewStates.Visible; }; return view; }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Main); TabHost.TabSpec spec; // Resusable TabSpec for each tab Intent intent; // Reusable Intent for each tab // Create an Intent to launch an Activity for the tab intent = new Intent(this, typeof(LunchDayActivity)); intent.AddFlags(ActivityFlags.NewTask); // Initialize a TabSpec for each tab and add it to the TabHost spec = TabHost.NewTabSpec("lunchtable"); spec.SetIndicator(Resources.GetString(Resource.String.lunchtable), Resources.GetDrawable(Resource.Drawable.menu)); spec.SetContent(intent); TabHost.AddTab(spec); intent = new Intent(this, typeof(TimetableActivity)); intent.AddFlags(ActivityFlags.NewTask); spec = TabHost.NewTabSpec("timetables"); spec.SetIndicator(Resources.GetString(Resource.String.timetable), Resources.GetDrawable(Resource.Drawable.timetable)); spec.SetContent(intent); TabHost.AddTab(spec); intent = new Intent(this, typeof(ShowSettings)); intent.AddFlags(ActivityFlags.NewTask); spec = TabHost.NewTabSpec("settings"); spec.SetIndicator(Resources.GetString(Resource.String.settings), Resources.GetDrawable(Resource.Drawable.settings)); spec.SetContent(intent); TabHost.AddTab(spec); TabHost.CurrentTab = 0; }
/// <summary> /// 启动处理权限过程的 Activity /// </summary> private void StartAcpActivity() { lock (this) { Intent intent = new Intent(mContext, typeof(AcpActivity)); intent.AddFlags(ActivityFlags.NewTask); //Intent.InterfaceConsts.FLAG_ACTIVITY_NEW_TASK mContext.StartActivity(intent); } }
public void TryOpenMap(double latitude, double longitude, string findOption, bool flagActivity = false) { Android.Net.Uri intentUri = Android.Net.Uri.Parse ($"geo:{latitude.ToString(CultureInfo.InvariantCulture)},{longitude.ToString(CultureInfo.InvariantCulture)}?q={findOption}"); Android.Content.Intent mapIntent = new Android.Content.Intent(Android.Content.Intent.ActionView, intentUri); mapIntent.SetPackage("com.google.android.apps.maps"); if (flagActivity) { mapIntent.AddFlags(ActivityFlags.NewTask); } Android.App.Application.Context.StartActivity(mapIntent); }