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


C# Intent.AddCategory方法代码示例

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


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

示例1: OnCreate

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.PublicJournalGroupList);
             basePath = Intent.GetStringExtra("pjBaseURL");
             this.Title = "Group of Departments";
            if (!string.IsNullOrEmpty(basePath))
            {
                try
                {
                    FillDepartments(basePath);

                    //Notification.Builder builder = new Notification.Builder(this).SetContentText("My text").SetContentTitle("Title goes here.").SetSmallIcon(Resource.Drawable.Icon);
                    //Notification notification = builder.Build();
                    //NotificationManager notifyMngr = GetSystemService(Context.NotificationService) as NotificationManager;
                    //notifyMngr.Notify(0, notification);
                    //Localhost360Sites.Sites sites = new Localhost360Sites.Sites();
                    //sites.Credentials.GetCredential()
                }
                catch (Exception ex)
                {

                }
            }
            else
            {
                Intent startMain = new Intent(Intent.ActionMain);
                startMain.AddCategory(Intent.CategoryHome);
                // startMain.SetFlags(Intent.Flags);
                StartActivity(startMain);
            }
            // Create your application here
        }
开发者ID:vcgupta,项目名称:ConnectMe_AndroidAppTest,代码行数:33,代码来源:PJDepartmentListActivity.cs

示例2: LoadApps

		private void LoadApps ()
		{
			Intent mainIntent = new Intent (Intent.ActionMain, null);
			mainIntent.AddCategory (Intent.CategoryLauncher);

			mApps = PackageManager.QueryIntentActivities (mainIntent, 0);
		}
开发者ID:CHANDAN145,项目名称:monodroid-samples,代码行数:7,代码来源:Grid3.cs

示例3: GetLauncherPackageName

 public static string GetLauncherPackageName(Context context)
 {
     Intent intent = new Intent(Intent.ActionMain);
     intent.AddCategory(Intent.CategoryHome);
     ResolveInfo resolveInfo = context.PackageManager.ResolveActivity(intent, PackageInfoFlags.MatchDefaultOnly);
     return resolveInfo.ActivityInfo.PackageName;
 }
开发者ID:es-repo,项目名称:wlpgnr,代码行数:7,代码来源:IntentShortcuts.cs

示例4: OnBackPressed

 public override void OnBackPressed()
 {
     var StartMain = new Intent (Intent.ActionMain);
     StartMain.AddCategory (Intent.CategoryHome);
     StartMain.SetFlags (ActivityFlags.NewTask);
     StartActivity (StartMain);
 }
开发者ID:FrederickEskens,项目名称:Totem,代码行数:7,代码来源:MainActivity.cs

示例5: GetDemoActivities

        private List<ActivityListItem> GetDemoActivities(string prefix)
        {
            var results = new List<ActivityListItem>();

            // Create an intent to query the package manager with,
            // we are looking for ActionMain with our custom category
            var query = new Intent(Intent.ActionMain, null);
            query.AddCategory(SampleCategory);

            var list = PackageManager.QueryIntentActivities(query, 0);

            // If there were no results, bail
            if (list == null)
                return results;

            results.AddRange(from resolve in list
                             let category = resolve.LoadLabel(PackageManager)
                             let type =
                                 string.Format("{0}:{1}", resolve.ActivityInfo.ApplicationInfo.PackageName,
                                               resolve.ActivityInfo.Name)
                             where
                                 string.IsNullOrWhiteSpace(prefix) ||
                                 category.StartsWith(prefix, StringComparison.InvariantCultureIgnoreCase)
                             select new ActivityListItem(prefix, category, type));

            return results;
        }
开发者ID:Dexyon,项目名称:ViewPagerIndicator,代码行数:27,代码来源:ListSamples.cs

示例6: GetDemoActivities

		private List<ActivityListItem> GetDemoActivities (string prefix)
		{
			var results = new List<ActivityListItem> ();

			// Create an intent to query the package manager with,
			// we are looking for ActionMain with our custom category
			Intent query = new Intent (Intent.ActionMain, null);
			query.AddCategory (ViewPagerIndicator.SAMPLE_CATEGORY);

			var list = PackageManager.QueryIntentActivities (query, 0);

			// If there were no results, bail
			if (list == null)
				return results;	

			// Process the results
			foreach (var resolve in list) {
				// Get the menu category from the activity label
				var category = resolve.LoadLabel (PackageManager);

				// Get the data we'll need to launch the activity
				string type = string.Format ("{0}:{1}", resolve.ActivityInfo.ApplicationInfo.PackageName, resolve.ActivityInfo.Name);

				if (string.IsNullOrWhiteSpace (prefix) || category.StartsWith (prefix, StringComparison.InvariantCultureIgnoreCase))
					results.Add (new ActivityListItem (prefix, category, type));
			}

			return results;
		}
开发者ID:wada811,项目名称:Xamarin.Android.ViewPagerIndicator,代码行数:29,代码来源:ViewPagerIndicator.cs

示例7: GetData

		protected JavaList<IDictionary<String, Object>> GetData (String prefix)
		{
			var myData = new List<IDictionary<String, Object>> ();

			Intent mainIntent = new Intent (Intent.ActionMain, null);
			mainIntent.AddCategory (SampleCategory);

			PackageManager pm = PackageManager;
			IList<ResolveInfo> list = (IList<ResolveInfo>) pm.QueryIntentActivities (mainIntent, PackageInfoFlags.Activities);

			if (null == list)
				return new JavaList<IDictionary<String, Object>> (myData);

			String[] prefixPath;
			String prefixWithSlash = prefix;

			if (prefix.Equals ("")) {
				prefixPath = null;
			} else {
				prefixPath = prefix.Split ('/');
				prefixWithSlash = prefix + "/";
			}

			int len = list.Count;

			IDictionary<String, bool?> entries = new JavaDictionary<String, bool?> ();

			for (int i = 0; i < len; i++) {
				ResolveInfo info = list [i];
				var labelSeq = info.LoadLabel (pm);
				String label = labelSeq != null
					? labelSeq.ToString ()
						: info.ActivityInfo.Name;

				if (prefixWithSlash.Length  == 0 || label.StartsWith (prefixWithSlash)) {

					String[] labelPath = label.Split ('/');

					String nextLabel = prefixPath == null ? labelPath [0] : labelPath [prefixPath.Length];

					if ((prefixPath != null ? prefixPath.Length : 0) == labelPath.Length - 1) {
						AddItem (myData, nextLabel, ActivityIntent (
							info.ActivityInfo.ApplicationInfo.PackageName,
							info.ActivityInfo.Name));
					} else {
						if (entries [nextLabel] == null) {
							AddItem (myData, nextLabel, BrowseIntent (prefix.Equals ("") ? nextLabel : prefix + "/" + nextLabel));
							entries [nextLabel] = true;
						}
					}
				}
			}

			myData.Sort (sDisplayNameComparator);

			return new JavaList<IDictionary<String, Object>> (myData);
		}
开发者ID:BratislavDimitrov,项目名称:monodroid-samples,代码行数:57,代码来源:Demos.cs

示例8: OnBackPressed

 public override void OnBackPressed()
 {
     Intent intent = new Intent(Intent.ActionMain);
     intent.AddCategory(Intent.CategoryHome);
     intent.SetFlags(ActivityFlags.ClearTop);
     StartActivity(intent);
     Finish();
     Process.KillProcess(Process.MyPid());
 }
开发者ID:WakeDown,项目名称:UnitPrinter,代码行数:9,代码来源:MainActivity.cs

示例9: BroadcastStarted

 //bcast the msg to all actvities
 private void BroadcastStarted( MyMessage msg)
 {
     Intent BroadcastIntent = new Intent(this, typeof(ChatActivity.MsgBroadcasrReceiver));
     BroadcastIntent.PutExtra("fromEmail", msg.email);
     BroadcastIntent.PutExtra("fromName", msg.first_name);
     BroadcastIntent.PutExtra("message", msg.message);
     BroadcastIntent.SetAction(ChatActivity.MsgBroadcasrReceiver.MSG_BCAST);
     BroadcastIntent.AddCategory(Intent.CategoryDefault);
     SendBroadcast(BroadcastIntent);
 }
开发者ID:DlerAhmad,项目名称:AndroidMessenger,代码行数:11,代码来源:MsgApiService.cs

示例10: OnKeyUp

		public override bool OnKeyUp (Keycode keyCode, KeyEvent e)
		{
			if (keyCode == Keycode.Back) {
				Intent intent = new Intent(Intent.ActionMain);
				intent.AddCategory(Intent.CategoryHome);
				intent.SetFlags(ActivityFlags.NewTask);
				StartActivity(intent);
			}
			return true;
		}
开发者ID:borain89vn,项目名称:demo2,代码行数:10,代码来源:MyProfileActivity.cs

示例11: OnOptionsItemSelected

 override public bool OnOptionsItemSelected(IMenuItem item)
 {
    int itemId = item.GetItemId();
    if (itemId == R.Ids.change_locale)
    {
       Intent intent = new Intent(Intent.ACTION_MAIN);
       intent.SetAction(Android.Provider.Settings.ACTION_LOCALE_SETTINGS);
       intent.AddCategory(Intent.CATEGORY_DEFAULT);
       StartActivity(intent);
       return true;
    }
    return base.OnOptionsItemSelected(item);
 }
开发者ID:MahendrenGanesan,项目名称:samples,代码行数:13,代码来源:PlusSampleActivity.cs

示例12: GetHomePackage

		/// <summary>
		/// Get home package
		/// </summary>
	    public string GetHomePackage(Context context) {

			var intent = new Intent(Intent.ActionMain);
			intent.AddCategory(Intent.CategoryHome);

			ResolveInfo resolveInfo = context.PackageManager.ResolveActivity(intent, PackageInfoFlags.MatchDefaultOnly);

	        if (resolveInfo != null && resolveInfo.ActivityInfo != null && resolveInfo.ActivityInfo.PackageName != null) {
	            return resolveInfo.ActivityInfo.PackageName;
	        }

			return context.PackageName;
	    }
开发者ID:alexrainman,项目名称:Xamarin.Badge,代码行数:16,代码来源:HomePackageIdentify.cs

示例13: GetApps

		private IList<AppDetail> GetApps ()
		{
			var i = new Intent (Intent.ActionMain);
			i.AddCategory (Intent.CategoryLauncher);

			var activities = PackageManager.QueryIntentActivities (i, PackageInfoFlags.Activities);

			return activities
				.Select (a => new AppDetail {
				Label = a.LoadLabel (PackageManager),
				Name = a.ActivityInfo.PackageName,
				Icon = a.ActivityInfo.LoadIcon (PackageManager)
			})
				.OrderBy (a => a.Label)
				.ToList ();
		}
开发者ID:oliver-johnston,项目名称:launcher,代码行数:16,代码来源:MainActivity.cs

示例14: BroadcastStarted

 /// <summary>
 /// Service broadcasting to activities along with data 
 /// </summary>
 /// <param name="location"></param>
 /// <param name="InComingData"></param>
 private void BroadcastStarted(Coordinates location, string InComingData)
 {
     try
     {
         Intent BroadcastIntent = new Intent(this, typeof(GelLocation.MyLocationReceiver));
         BroadcastIntent.SetAction(GelLocation.MyLocationReceiver.GRID_STARTED);
         BroadcastIntent.AddCategory(Intent.CategoryDefault);                
         var cordinates = JsonConvert.SerializeObject(location);
         BroadcastIntent.PutExtra(InComingData, cordinates);
         SendBroadcast(BroadcastIntent);
     }
     catch (Exception ex)
     {
         Toast.MakeText(Application.Context, "Broadcast", ToastLength.Long).Show();
     }
 }
开发者ID:mdhammad313,项目名称:GPS-Tracker,代码行数:21,代码来源:BackgroundService.cs

示例15: LastTwoBroadcastDate

        private void LastTwoBroadcastDate(DateTime[] timeStamp)
        {
            try
            {
                Intent BroadcastIntent = new Intent(this, typeof(GelLocation.MyLocationReceiver));
                BroadcastIntent.SetAction(GelLocation.MyLocationReceiver.GRID_STARTED);
                BroadcastIntent.AddCategory(Intent.CategoryDefault);

                var cordinates = JsonConvert.SerializeObject(timeStamp);
                BroadcastIntent.PutExtra("timeStamp", cordinates);
                SendBroadcast(BroadcastIntent);

            }
            catch (Exception ex)
            {
                Toast.MakeText(Application.Context, "Broadcast two", ToastLength.Long).Show();
            }
        }
开发者ID:mdhammad313,项目名称:GPS-Tracker,代码行数:18,代码来源:BackgroundService.cs


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