当前位置: 首页>>代码示例>>C#>>正文


C# Intent.SetFlags方法代码示例

本文整理汇总了C#中Android.Content.Intent.SetFlags方法的典型用法代码示例。如果您正苦于以下问题:C# Intent.SetFlags方法的具体用法?C# Intent.SetFlags怎么用?C# Intent.SetFlags使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Android.Content.Intent的用法示例。


在下文中一共展示了Intent.SetFlags方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OpenModal

        public void OpenModal(string key)
        {
            var activityType = _pageKeys[key];

            var intent = new Intent(Application.Context, activityType);
            intent.SetFlags(ActivityFlags.NoHistory);
            intent.SetFlags (ActivityFlags.NewTask);

            Application.Context.StartActivity(intent);
        }
开发者ID:dhindrik,项目名称:MvvmLightNavigationExtension,代码行数:10,代码来源:NavigationServiceExtension.cs

示例2: ShareOnService

 private void ShareOnService(string status, string title = "", string link = "")
 {
     var intent = new Intent(global::Android.Content.Intent.ActionSend);
     intent.PutExtra(global::Android.Content.Intent.ExtraText, String.Format("{0} - {1}",status ?? string.Empty,link ?? string.Empty));
     intent.PutExtra(global::Android.Content.Intent.ExtraSubject, title ?? string.Empty);
     intent.SetType("text/plain");
     intent.SetFlags(ActivityFlags.ClearTop);
     intent.SetFlags(ActivityFlags.NewTask);
     Android.App.Application.Context.StartActivity(intent);
 }
开发者ID:JoshuaNovak919,项目名称:SharePlugin,代码行数:10,代码来源:ShareImplementation.cs

示例3: SendSms

    public void SendSms(string body, string phoneNumber)
    {
      var smsUri = Android.Net.Uri.Parse("smsto:" + phoneNumber);
      var smsIntent = new Intent(Intent.ActionSendto, smsUri);
      smsIntent.PutExtra("sms_body", body);
      smsIntent.PutExtra(Intent.ExtraText, body);

      //these flags are required when using application context
      smsIntent.SetFlags(ActivityFlags.ClearTop);
      smsIntent.SetFlags(ActivityFlags.NewTask);
      Android.App.Application.Context.StartActivity(smsIntent);
    }
开发者ID:charifield,项目名称:Xamarin.Plugins,代码行数:12,代码来源:SmsImplementation.cs

示例4: ShareUrl

        public async Task ShareUrl(string url, string title = null, string subject = null)
        {
            var intent = new Intent(Intent.ActionSend);
            intent.SetType("text/plain");
            intent.PutExtra(Intent.ExtraText, url);
            intent.PutExtra(Intent.ExtraSubject, subject ?? string.Empty);

            intent.SetFlags(ActivityFlags.ClearTop);
            intent.SetFlags(ActivityFlags.NewTask);
            var chooserIntent = Intent.CreateChooser(intent, title ?? string.Empty);
            Android.App.Application.Context.StartActivity(chooserIntent);

        }
开发者ID:roscowolf,项目名称:Xamarin.Plugins,代码行数:13,代码来源:ShareImplementation.cs

示例5: TryIntent

 private bool TryIntent(Intent intent)
 {
   try
   {
     intent.SetFlags(ActivityFlags.ClearTop);
     intent.SetFlags(ActivityFlags.NewTask);
     Android.App.Application.Context.StartActivity(intent);
     return true;
   }
   catch(ActivityNotFoundException)
   {
     return false;
   }
 }
开发者ID:elviosousa,项目名称:Xamarin.Plugins,代码行数:14,代码来源:ExternalMapsImplementation.cs

示例6: OnCreate

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

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            // Get our button from the layout resource,
            // and attach an event to it
            Button button = FindViewById<Button>(Resource.Id.MyButton);

            button.Click += delegate {
                button.Text = string.Format("{0} clicks!", count++); };

            var file = fileFromAsset(this, "test.pdf");

            //var uri = Android.Net.Uri.FromFile(new File("file:///android_asset/test.pdf"));

            var uri = Android.Net.Uri.Parse(file.AbsolutePath);
            var intent = new Intent (this, typeof (MuPDFActivity));
            intent.SetFlags (ActivityFlags.NoHistory);
            intent.SetAction (Intent.ActionView);
            intent.SetData(uri);
            this.StartActivity(intent);
        }
开发者ID:SaberZA,项目名称:XamarinPdfTest,代码行数:25,代码来源:MainActivity.cs

示例7: EnableVoiceSynthesisEngine

 public void EnableVoiceSynthesisEngine()
 {
     Intent intent = new Intent();
     intent.SetAction("com.android.settings.TTS_SETTINGS");
     intent.SetFlags(ActivityFlags.NewTask);
     CurrentActivity.StartActivity(intent);
 }
开发者ID:india-rose,项目名称:xamarin-indiarose,代码行数:7,代码来源:InstallVoiceSynthesisService.cs

示例8: OnBackPressed

 public override void OnBackPressed()
 {
     intent = new Intent(this, typeof(SetUpActivity));
     intent.PutExtra("content", SetUpActivity.TERMINATE);
     intent.SetFlags(ActivityFlags.ClearTop);
     StartActivity(intent);
 }
开发者ID:paulombcosta,项目名称:mono-mobilis,代码行数:7,代码来源:LoginActivity.cs

示例9: OnListItemClick

		protected override void OnListItemClick(Android.Widget.ListView l, Android.Views.View v, int position, long id)
		{
			var intent = new Intent(this, typeof (GameActivity));
			intent.SetFlags(ActivityFlags.NewTask | ActivityFlags.SingleTop);
			intent.PutExtra("Type", sampleTypes[position].AssemblyQualifiedName);
			StartActivity(intent);
		}
开发者ID:jiailiuyan,项目名称:urho-samples,代码行数:7,代码来源:SamplesSelectorActivity.cs

示例10: onCallStateChanged

        public void onCallStateChanged(string state, string incomingNumber, Context _context)
        {
            // TODO React to incoming call. // React to incoming call. string number=incomingNumber;
            //screen =_Context.FindViewById<ViewGroup>(Resource.Id.IncomingCall);
            // If phone ringing
            if(state == TelephonyManager.ExtraStateRinging )
            {

                /*var i = new Intent(_context, typeof (PlayerSevise));
                i.PutExtra(PlayerSevise.CommandExtraName, PlayerSevise.PlayCommand);
                _context.StartService (i);*/

                var i = new Intent(_context, typeof (CallActivity));
                i.SetFlags (ActivityFlags.NewTask);
                _context.StartActivity (i);

                //Toast.MakeText(this, " Phone Is Riging ", ToastLength.Long).Show()
                //Toast.MakeText(_context,"phone is neither ringing nor in a call", ToastLength.Long).Show();

                }
            if (state == TelephonyManager.ExtraStateIdle) {
                /*var i = new Intent(_context, typeof (PlayerSevise));
                i.PutExtra(PlayerSevise.CommandExtraName, PlayerSevise.StopCommand);
                _context.StartService (i);*/
            }

            if (state == TelephonyManager.ExtraStateOffhook) {
                /*var i = new Intent(_context, typeof (PlayerSevise));
                i.PutExtra(PlayerSevise.CommandExtraName, PlayerSevise.StopCommand);
                _context.StartService (i);*/
            }
        }
开发者ID:GeniusAtamans,项目名称:VideoBuyApp,代码行数:32,代码来源:CallResiver.cs

示例11: OpenGallery

 public static void OpenGallery(Context context)
 {
     Intent intent = new Intent(Intent.ActionView);
     intent.SetType("image/*");
     intent.SetFlags(ActivityFlags.NewTask);
     context.StartActivity(intent);
 }
开发者ID:es-repo,项目名称:wlpgnr,代码行数:7,代码来源:IntentShortcuts.cs

示例12: OnCreate

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

            // Create your application here
            SetContentView (Resource.Layout.QuestionnaireSummary);
            int Ergebnis = Intent.GetIntExtra ("ergebnis", 0);

            TextView ErgebnisText = FindViewById<TextView> (Resource.Id.textView3);
            ErgebnisText.Text = string.Format ("{0} {1}", Resources.GetText (Resource.String.total_score), Ergebnis);

            Button ContinueHome = FindViewById<Button> (Resource.Id.button1);
            ContinueHome.Click += delegate {
                //create an intent to go to the next screen
                Intent intent = new Intent(this, typeof(Home));
                intent.SetFlags(ActivityFlags.ClearTop); //remove the history and go back to home screen
                StartActivity(intent);
            };

            //Toast.MakeText (this, string.Format ("{0}", DateTime.Now.ToString("dd.MM.yy HH:mm")), ToastLength.Short).Show();

            ContentValues insertValues = new ContentValues();
            insertValues.Put("date_time", DateTime.Now.ToString("dd.MM.yy HH:mm"));
            insertValues.Put("ergebnis", Ergebnis);
            dbRUOK = new RUOKDatabase(this);
            dbRUOK.WritableDatabase.Insert ("RUOKData", null, insertValues);

            //The following two function were used to understand the usage of SQLite. They are not needed anymore and I just keep them in case I wanna later look back at them.
            //InitializeSQLite3(Ergebnis);
            //ReadOutDB ();
        }
开发者ID:fsoyka,项目名称:RUOK,代码行数:31,代码来源:QuestionnaireSummary.cs

示例13: Show

 public void Show()
 {
     Intent intent = new Intent(Intent.ActionView);
     intent.SetData(Android.Net.Uri.Parse(Uri.OriginalString));
     intent.SetFlags(ActivityFlags.NewTask);
     Application.Context.StartActivity(intent);
 }
开发者ID:CartBlanche,项目名称:MonoGame-Support,代码行数:7,代码来源:WebBrowserTask.cs

示例14: SetHeader

        public void SetHeader(String title, bool btnHomeVisible, bool btnFeedbackVisible)
        {
            ViewStub stub = (ViewStub) FindViewById(Resource .Id .vsHeader);
              		View inflated = stub.Inflate();

            TextView txtTitle = (TextView) inflated.FindViewById(Resource.Id.txtHeading );
            txtTitle.Text=title;

            Button btnHome = (Button) inflated.FindViewById(Resource .Id.btnHome );

            if(!btnHomeVisible)
                btnHome.Visibility = Android.Views .ViewStates .Invisible ;

            btnHome .Click+= delegate(object sender, EventArgs e) {

                 Intent intent = new Intent(this.ApplicationContext , typeof (HomeActivity ));
              		 intent.SetFlags (ActivityFlags.ClearTop );
              		 StartActivity(intent);
            };

            Button btnFeedback = (Button) inflated.FindViewById( Resource.Id.btnFeedback);
            if(!btnFeedbackVisible)
                btnFeedback.Visibility = Android.Views .ViewStates .Invisible ;

            btnFeedback .Click += delegate(object sender, EventArgs e) {
                 Intent intent = new Intent(this.ApplicationContext , typeof (ActivityFeedback));
              		 intent.SetFlags (ActivityFlags.ClearTop );
              		 StartActivity(intent);

            };
        }
开发者ID:CodigoMonki,项目名称:MonoAndroidSamples,代码行数:31,代码来源:DashboardActivity.cs

示例15: DidEnterRegion

		public void DidEnterRegion(AltBeaconOrg.BoundBeacon.Region region)
		{
			// In this example, this class sends a notification to the user whenever a Beacon
			// matching a Region (defined above) are first seen.
			Log.Debug(TAG, "did enter region.");
			if (!haveDetectedBeaconsSinceBoot) 
			{
				Log.Debug(TAG, "auto launching MonitoringActivity");

				// The very first time since boot that we detect an beacon, we launch the
				// MainActivity
				var intent = new Intent(this, typeof(MainActivity));
				intent.SetFlags(ActivityFlags.NewTask);
				// Important:  make sure to add android:launchMode="singleInstance" in the manifest
				// to keep multiple copies of this activity from getting created if the user has
				// already manually launched the app.
				this.StartActivity(intent);
				haveDetectedBeaconsSinceBoot = true;
			} 
			else 
			{
				if (mainActivity != null) {
					Log.Debug(TAG, "I see a beacon again");
				} 
				else 
				{
					// If we have already seen beacons before, but the monitoring activity is not in
					// the foreground, we send a notification to the user on subsequent detections.
					Log.Debug(TAG, "Sending notification.");
					SendNotification();
				}
			}
		}
开发者ID:Denn1992,项目名称:Android-AltBeacon-Library,代码行数:33,代码来源:BeaconReferenceApplication.cs


注:本文中的Android.Content.Intent.SetFlags方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。