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


C# Net.Uri类代码示例

本文整理汇总了C#中Android.Net.Uri的典型用法代码示例。如果您正苦于以下问题:C# Android.Net.Uri类的具体用法?C# Android.Net.Uri怎么用?C# Android.Net.Uri使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: OnCreate

		protected override void OnCreate (Bundle icicle)
		{
			//base.OnCreate(icicle);
			if (!LibsChecker.CheckVitamioLibs (this))
				return;
			SetContentView (Resource.Layout.videobuffer);
			mVideoView = FindViewById<VideoView> (Resource.Id.buffer);
			pb = FindViewById<ProgressBar> (Resource.Id.probar);

			downloadRateView = FindViewById<TextView> (Resource.Id.download_rate);
			loadRateView = FindViewById<TextView> (Resource.Id.load_rate);
			if (path == "") {
				// Tell the user to provide a media file URL/path.
				Toast.MakeText (this, "Please edit VideoBuffer Activity, and set path" + " variable to your media file URL/path", ToastLength.Long).Show ();
				return;
			} else {
				//      
				//       * Alternatively,for streaming media you can use
				//       * mVideoView.setVideoURI(Uri.parse(URLstring));
				//       
				uri = Android.Net.Uri.Parse (path);
				mVideoView.SetVideoURI (uri);
				mVideoView.SetMediaController (new MediaController (this));
				mVideoView.RequestFocus ();
				mVideoView.SetOnInfoListener (this);
				mVideoView.SetOnBufferingUpdateListener (this);
				mVideoView.Prepared += (object sender, MediaPlayer.PreparedEventArgs e) => {
					e.P0.SetPlaybackSpeed(1.0f);
				};
			}
		}
开发者ID:shaxxx,项目名称:Xamarin.Vitamio,代码行数:31,代码来源:VideoViewBuffer.cs

示例2: OnActivityResult

		protected override void OnActivityResult (int requestCode, Result resultCode, Intent data)
		{
			base.OnActivityResult (requestCode, resultCode, data);
			if (resultCode == Result.Ok) {
				//user is returning from capturing an image using the camera
				if(requestCode == CAMERA_CAPTURE){
					//get the Uri for the captured image
					picUri = data.Data;
					//carry out the crop operation
					performCrop();
				}
				//user is returning from cropping the image
				else if(requestCode == PIC_CROP){
					//get the returned data
					Bundle extras = data.Extras;
					//get the cropped bitmap
					Bitmap thePic = (Android.Graphics.Bitmap)extras.GetParcelable("data");
					//retrieve a reference to the ImageView
					ImageView picView = FindViewById<ImageView>(Resource.Id.picture);
					//display the returned cropped image
					picView.SetImageBitmap(thePic);
					//Store Image in Phone
					Android.Provider.MediaStore.Images.Media.InsertImage(ContentResolver,thePic,"imgcrop","Description");
				}
			}
		}
开发者ID:jeedey93,项目名称:xamarin-android-samples,代码行数:26,代码来源:MainActivity.cs

示例3: GetPath

 protected string GetPath(Uri uri)
 {
     string[] projection = { MediaStore.Images.Media.InterfaceConsts.Data };
     ICursor cursor = Activity.ManagedQuery(uri, projection, null, null, null);
     int index = cursor.GetColumnIndexOrThrow(MediaStore.Images.Media.InterfaceConsts.Data);
     cursor.MoveToFirst();
     return cursor.GetString(index);
 }
开发者ID:Fedorm,项目名称:core-master,代码行数:8,代码来源:GalleryProvider.cs

示例4: OnActivityResult

        protected override void OnActivityResult(int requestCode, Result resultCode, Intent data)
        {
            base.OnActivityResult (requestCode, resultCode, data);

            if (resultCode == Result.Ok) {
                chooseButton.SetImageURI (data.Data);
                imageUri = data.Data;
            }
        }
开发者ID:bertouttier,项目名称:ExpenseApp-Mono,代码行数:9,代码来源:AbroadActivity.cs

示例5: Image

        /// <summary>
        /// Sets the image to share. This can only be called once, you can only share one video or image. Not both.
        /// </summary>
        /// <param name="uri"><see cref="Android.Net.Uri"/> with the Uri to the image</param>
        /// <exception cref="ArgumentNullException">Throws if <param name="uri"/> is null.</exception>
        /// <exception cref="InvalidOperationException">Throws if an Image or Video Uri has already been set. Only one Image or Video Uri allowed</exception>
        public SocialShare Image(Android.Net.Uri uri)
        {
            if (uri == null) throw new ArgumentNullException(nameof(uri));
            if (_uri != null) throw new InvalidOperationException("Only one Image or Video Uri allowed");

            _uri = uri;
            _mimeType = Mime.AnyImage;
            return this;
        }
开发者ID:Cheesebaron,项目名称:Chelle,代码行数:15,代码来源:SocialShare.cs

示例6: CapturamosImagen

		void CapturamosImagen ()
		{
			//FUNCION QUE SE ENCARGA DE CAPTURAR LA IMAGEN USANDO UN INTENT
			Intent intent = new Intent (MediaStore.ActionImageCapture);
			fileUri = GetOutputMediaFile (this.ApplicationContext, IMAGE_DIRECTORY_NAME, String.Empty);
			intent.PutExtra(MediaStore.ExtraOutput, fileUri);

			//LANZAMOS NUESTRO ITEM PARA CAPTURA LA IMAGEN
			StartActivityForResult(intent, CAMERA_CAPTURE_IMAGE_REQUEST_CODE);
		}
开发者ID:DiLRandI,项目名称:Xamarin.android,代码行数:10,代码来源:MainActivity.cs

示例7: OnCreate

		public override void OnCreate (Bundle p0)
		{
			base.OnCreate (p0);
			
			Intent intent = BaseActivity.FragmentArgumentsToIntent (Arguments);
			mVendorUri = intent.Data;
			if (mVendorUri == null) {
				return;
			}
	
			SetHasOptionsMenu (true);
		}
开发者ID:BratislavDimitrov,项目名称:monodroid-samples,代码行数:12,代码来源:VendorDetailFragment.cs

示例8: OnCreate

        /// <summary>
        /// Override default OnCreate
        /// </summary>
        /// <param name="bundle"></param>
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.Main);

            Button browseButton = FindViewById<Button>(Resource.Id.ButtonBrowse);

            //When "Browse" button clicked, fire an intent to select image
            browseButton.Click += delegate
            {
                Intent imageIntent = new Intent();
                imageIntent.SetType(FileType_Image);
                imageIntent.SetAction(Intent.ActionGetContent);
                StartActivityForResult(
                    Intent.CreateChooser(imageIntent, PromptText_SelectImage), PICK_IMAGE);
            };

            Button takePictureButton = FindViewById<Button>(Resource.Id.ButtonTakePicture);

            //When "Take a picture" button clicked, fire an intent to take picture
            takePictureButton.Click += delegate
            {
                Intent takePictureIntent = new Intent(MediaStore.ActionImageCapture);
                if (takePictureIntent.ResolveActivity(PackageManager) != null)
                {
                    // Create the File where the photo should go
                    Java.IO.File photoFile = null;
                    try
                    {
                        photoFile = createImageFile();
                    }
                    catch (Java.IO.IOException)
                    {
                        //TODO: Error handling
                    }  
                    // Continue only if the File was successfully created
                    if (photoFile != null)
                    {
                        takePictureIntent.PutExtra(MediaStore.ExtraOutput, 
                            Android.Net.Uri.FromFile(photoFile));

                        //Delete this temp file, only keey its Uri information
                        photoFile.Delete();

                        TempFileUri = Android.Net.Uri.FromFile(photoFile);
                        StartActivityForResult(takePictureIntent, TAKE_PICTURE);
                    }
                }
            };
                    
        }
开发者ID:aweeesome,项目名称:faceit,代码行数:56,代码来源:MainActivity.cs

示例9: TakePicture

        public void TakePicture(int maxPixelDimension, int percentQuality, Action<Stream> pictureAvailable,
                                Action assumeCancelled)
        {
            var intent = new Intent(MediaStore.ActionImageCapture);

            _cachedUriLocation = GetNewImageUri();
            intent.PutExtra(MediaStore.ExtraOutput, _cachedUriLocation);
            intent.PutExtra("outputFormat", Bitmap.CompressFormat.Jpeg.ToString());
            intent.PutExtra("return-data", true);

            ChoosePictureCommon(MvxIntentRequestCode.PickFromCamera, intent, maxPixelDimension, percentQuality,
                                pictureAvailable, assumeCancelled);
        }
开发者ID:JoanMiro,项目名称:MvxMod,代码行数:13,代码来源:MvxPictureChooserTask.cs

示例10: GetPathToImage

 private string GetPathToImage(Uri uri)
 {
     string path = null;
     // The projection contains the columns we want to return in our query.
     string[] projection = new[] { Android.Provider.MediaStore.Images.Media.InterfaceConsts.Data };
     using (ICursor cursor = ManagedQuery(uri, projection, null, null, null))
     {
         if (cursor != null)
         {
             int columnIndex = cursor.GetColumnIndexOrThrow(Android.Provider.MediaStore.Images.Media.InterfaceConsts.Data);
             cursor.MoveToFirst();
             path = cursor.GetString(columnIndex);
         }
     }
     return path;
 }
开发者ID:uptredlabs,项目名称:Mobile,代码行数:16,代码来源:PickFileActivity.cs

示例11: OnCreate

		public override void OnCreate (Bundle p0)
		{
			base.OnCreate (p0);
			
			Intent intent = BaseActivity.FragmentArgumentsToIntent (Arguments);
			mSessionUri = intent.Data;
			mTrackUri = ResolveTrackUri (intent);
			packageChangesReceiver = new PackageChangesReceiver (this);
			
			if (mSessionUri == null) {
				return;
			}
	
			mSessionId = ScheduleContract.Sessions.GetSessionId (mSessionUri);
			
			HasOptionsMenu = true;
		}
开发者ID:CHANDAN145,项目名称:monodroid-samples,代码行数:17,代码来源:SessionDetailFragment.cs

示例12: PerformCrop

        private void PerformCrop(Uri picUri, Action<string> callbackResult, string path)
        {
            Intent cropIntent = new Intent("com.android.camera.action.CROP");
            // indicate image type and Uri
            cropIntent.SetDataAndType(picUri, "image/*");
            // set crop properties
            cropIntent.PutExtra("crop", "true");
            // indicate aspect of desired crop
            cropIntent.PutExtra("aspectX", 1);
            cropIntent.PutExtra("aspectY", 1);
            // retrieve data on return
            cropIntent.PutExtra(MediaStore.ExtraOutput, picUri);
            // start the activity - we handle returning in onActivityResult
            ActivityService.StartActivityForResult(cropIntent, (result, data) =>
            {
				callbackResult(result == Result.Ok ? path : null);
            });
        }
开发者ID:india-rose,项目名称:xamarin-indiarose,代码行数:18,代码来源:MediaService.cs

示例13: doTakePhotoAction

        private void doTakePhotoAction()
        {

            Intent intent = new Intent(MediaStore.ActionImageCapture);

            mImageCaptureUri = Android.Net.Uri.FromFile(new Java.IO.File(createDirectoryForPictures(), string.Format("myPhoto_{0}.jpg", System.Guid.NewGuid())));

            intent.PutExtra(MediaStore.ExtraOutput, mImageCaptureUri);

            try
            {
                intent.PutExtra("return-data", false);
                StartActivityForResult(intent, PICK_FROM_CAMERA);
            }
            catch (ActivityNotFoundException e)
            {
                e.PrintStackTrace();
            }
        }
开发者ID:billy-lokal,项目名称:Dateifi_Old,代码行数:19,代码来源:MainActivity.cs

示例14: OnActivityResult

    protected override void OnActivityResult(int requestCode, Result resultCode, Intent data)
    {
      base.OnActivityResult(requestCode, resultCode, data);

      if (resultCode == Result.Ok)
      {
        this.imageUri = data.Data;
        try
        {
          if (this.imageBitmap != null)
            this.imageBitmap.Recycle();

          this.imageBitmap = MediaStore.Images.Media.GetBitmap(ContentResolver, data.Data);
          this.selectedImage.SetImageBitmap(this.imageBitmap);
        }
        catch (Exception)
        {
          Toast.MakeText(this, "Image is to large for preview", ToastLength.Long).Show();
        }
      }
    }
开发者ID:amatkivskiy,项目名称:sitecore-xamarin-pcl-sdk,代码行数:21,代码来源:UploadImageActivity.cs

示例15: LoadResampledBitmap

        private Bitmap LoadResampledBitmap(ContentResolver contentResolver, Uri uri, int sampleSize)
        {
            using (var inputStream = contentResolver.OpenInputStream(uri))
            {
                var optionsDecode = new BitmapFactory.Options {InSampleSize = sampleSize};

                return BitmapFactory.DecodeStream(inputStream, null, optionsDecode);
            }
        }
开发者ID:JoanMiro,项目名称:MvxMod,代码行数:9,代码来源:MvxPictureChooserTask.cs


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