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


C# Intent.GetBundleExtra方法代码示例

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


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

示例1: CreateNotification

		private void CreateNotification(Intent intent) {
			recipe = Recipe.FromBundle(intent.GetBundleExtra(Constants.ExtraRecipe));
			List<Notification> notificationPages = new List<Notification> ();

			int stepCount = recipe.RecipeSteps.Count;

			for (int i = 0; i < stepCount; i++) {
				Recipe.RecipeStep recipeStep = recipe.RecipeSteps [i];
				var style = new NotificationCompat.BigTextStyle ();
				style.BigText (recipeStep.StepText);
				style.SetBigContentTitle (String.Format (Resources.GetString (Resource.String.step_count), i + 1, stepCount));
				style.SetSummaryText ("");
				var builder = new NotificationCompat.Builder (this);
				builder.SetStyle (style);
				notificationPages.Add (builder.Build ());
			}

			var notifBuilder = new NotificationCompat.Builder(this);

			if (recipe.RecipeImage != null) {
				Bitmap recipeImage = Bitmap.CreateScaledBitmap(
					AssetUtils.LoadBitmapAsset(this, recipe.RecipeImage),
					Constants.NotificationImageWidth, Constants.NotificationImageHeight, false);
				notifBuilder.SetLargeIcon(recipeImage);
			}
			notifBuilder.SetContentTitle (recipe.TitleText);
			notifBuilder.SetContentText (recipe.SummaryText);
			notifBuilder.SetSmallIcon (Resource.Mipmap.ic_notification_recipe);

			Notification notification = notifBuilder.Extend(new NotificationCompat.WearableExtender().AddPages(notificationPages)).Build();
			notificationManager.Notify (Constants.NotificationId, notification);
		}
开发者ID:CHANDAN145,项目名称:monodroid-samples,代码行数:32,代码来源:RecipeService.cs

示例2: OnReceive

		public override void OnReceive (Context context, Intent intent)
		{
			PendingResult result = GoAsync ();

			// If app restriction settings are already created, they will be included in the Bundle
			// as key/value pairs.
			Bundle existingRestrictions = intent.GetBundleExtra (Intent.ExtraRestrictionsBundle);
			Log.Info (TAG, "existingRestrictions = " + existingRestrictions);

			Thread thread = new Thread (new ThreadStart (delegate {
				CreateRestrictions (context, result, existingRestrictions);
			}));

			thread.Start ();	
		}
开发者ID:89sos98,项目名称:monodroid-samples,代码行数:15,代码来源:GetRestrictionsReceiver.cs

示例3: HandleIntent

        private void HandleIntent(Intent intent)
        {
            if (intent.Action.Equals(Intent.ActionSearch)) {
                var query = intent.GetStringExtra(SearchManager.Query);
                Toast.MakeText(this, query, ToastLength.Short).Show();

                if (this.T1 != null) {
                    this.T1.Text = query;
                }

                var bundle = intent.GetBundleExtra(SearchManager.AppData);
                if (bundle != null) {
                    var key1 = bundle.GetBoolean("Key1");
                    var key2 = bundle.GetBoolean("Key2");
                }
            }
        }
开发者ID:gruan01,项目名称:Xamarin-Example,代码行数:17,代码来源:SearchActivity.cs

示例4: OnReceive

 public override void OnReceive(Context context, Intent intent)
 {
     var pluginPackage = intent.GetStringExtra(Strings.ExtraSender);
     if (new PluginDatabase(context).IsValidAccessToken(pluginPackage,
                                                        intent.GetStringExtra(Strings.ExtraAccessToken),
                                                        Strings.ScopeCurrentEntry))
     {
         if (intent.GetStringExtra(Strings.ExtraEntryId) != _activity.Entry.Uuid.ToHexString())
         {
             Kp2aLog.Log("received action for wrong entry " + intent.GetStringExtra(Strings.ExtraEntryId));
             return;
         }
         _activity.AddPluginAction(pluginPackage,
                                   intent.GetStringExtra(Strings.ExtraFieldId),
                                   intent.GetStringExtra(Strings.ExtraActionId),
                                   intent.GetStringExtra(Strings.ExtraActionDisplayText),
                                   intent.GetIntExtra(Strings.ExtraActionIconResId, -1),
                                   intent.GetBundleExtra(Strings.ExtraActionData));
     }
     else
     {
         Kp2aLog.Log("received invalid request. Plugin not authorized.");
     }
 }
开发者ID:pythe,项目名称:wristpass,代码行数:24,代码来源:EntryActivity.cs


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