/// <summary>Gets the activity or application icon for an activity.</summary>
		/// <remarks>Gets the activity or application icon for an activity.</remarks>
		/// <param name="component">Name of an activity.</param>
		/// <returns>
		/// A drawable, or
		/// <code>null</code>
		/// if neither the acitivy or the application
		/// have an icon set.
		/// </returns>
		private android.graphics.drawable.Drawable getActivityIcon(android.content.ComponentName
			 component)
		{
			android.content.pm.PackageManager pm = mContext.getPackageManager();
			android.content.pm.ActivityInfo activityInfo;
			try
			{
				activityInfo = pm.getActivityInfo(component, android.content.pm.PackageManager.GET_META_DATA
					);
			}
			catch (android.content.pm.PackageManager.NameNotFoundException ex)
			{
				android.util.Log.w(LOG_TAG, ex.ToString());
				return null;
			}
			int iconId = activityInfo.getIconResource();
			if (iconId == 0)
			{
				return null;
			}
			string pkg = component.getPackageName();
			android.graphics.drawable.Drawable drawable = pm.getDrawable(pkg, iconId, activityInfo
				.applicationInfo);
			if (drawable == null)
			{
				android.util.Log.w(LOG_TAG, "Invalid icon resource " + iconId + " for " + component
					.flattenToShortString());
				return null;
			}
			return drawable;
		}
Exemple #2
0
			internal override object createService(android.app.ContextImpl ctx)
			{
				return new android.app.DownloadManager(ctx.getContentResolver(), ctx.getPackageName
					());
			}