• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Net.Uri类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: LoadScaledBitmap

 private Bitmap LoadScaledBitmap(Uri uri)
 {
     ContentResolver contentResolver = this.GetService<IMvxAndroidGlobals>().ApplicationContext.ContentResolver;
     var maxDimensionSize = GetMaximumDimension(contentResolver, uri);
     var sampleSize = (int) Math.Ceiling((maxDimensionSize)/
                                         ((double) _currentRequestParameters.MaxPixelDimension));
     if (sampleSize < 1)
     {
         // this shouldn't happen, but if it does... then trace the error and set sampleSize to 1
         MvxTrace.Trace(
             "Warning - sampleSize of {0} was requested - how did this happen - based on requested {1} and returned image size {2}",
             sampleSize,
             _currentRequestParameters.MaxPixelDimension,
             maxDimensionSize);
         sampleSize = 1;
     }
     return LoadResampledBitmap(contentResolver, uri, sampleSize);
 }
开发者ID:JoanMiro,项目名称:MvxMod,代码行数:18,代码来源:MvxPictureChooserTask.cs


示例17: LoadInMemoryBitmap

 private MemoryStream LoadInMemoryBitmap(Uri uri)
 {
     var memoryStream = new MemoryStream();
     using (Bitmap bitmap = LoadScaledBitmap(uri))
     {
         bitmap.Compress(Bitmap.CompressFormat.Jpeg, _currentRequestParameters.PercentQuality, memoryStream);
     }
     memoryStream.Seek(0L, SeekOrigin.Begin);
     return memoryStream;
 }
开发者ID:JoanMiro,项目名称:MvxMod,代码行数:10,代码来源:MvxPictureChooserTask.cs


示例18: ProcessPictureUri

        private void ProcessPictureUri(MvxIntentResultEventArgs result, Uri uri)
        {
            if (_currentRequestParameters == null)
            {
                MvxTrace.Trace("Internal error - response received but _currentRequestParameters is null");
                return; // we have not handled this - so we return null
            }

            var responseSent = false;
            try
            {
                // Note for furture bug-fixing/maintenance - it might be better to use var outputFileUri = data.GetParcelableArrayExtra("outputFileuri") here?
                if (result.ResultCode != Result.Ok)
                {
                    MvxTrace.Trace("Non-OK result received from MvxIntentResult - {0} - request was {1}",
                                   result.ResultCode, result.RequestCode);
                    return;
                }

                if (uri == null
                    || string.IsNullOrEmpty(uri.Path))
                {
                    MvxTrace.Trace("Empty uri or file path received for MvxIntentResult");
                    return;
                }

                MvxTrace.Trace("Loading InMemoryBitmap started...");
                var memoryStream = LoadInMemoryBitmap(uri);
                MvxTrace.Trace("Loading InMemoryBitmap complete...");
                responseSent = true;
                MvxTrace.Trace("Sending pictureAvailable...");
                _currentRequestParameters.PictureAvailable(memoryStream);
                MvxTrace.Trace("pictureAvailable completed...");
                return;
            }
            finally
            {
                if (!responseSent)
                    _currentRequestParameters.AssumeCancelled();

                _currentRequestParameters = null;
            }
        }
开发者ID:JoanMiro,项目名称:MvxMod,代码行数:43,代码来源:MvxPictureChooserTask.cs


示例19: setImage

        private void setImage(Uri url) {
            uri = url;
            imageView.SetImageURI(uri);
            map = Android.Provider.MediaStore.Images.Media.GetBitmap(ContentResolver, uri);
            layoutHandle.Visibility = ViewStates.Visible;

        }
开发者ID:cvronmin,项目名称:resource-helper,代码行数:7,代码来源:EditActivity.cs


示例20: OnLocationChanged

 public void OnLocationChanged(string newLocation)
 {
     Android.Net.Uri uri = globalUri;
     if (uri != null) {
         long date = WeatherContractOpen.WeatherEntryOpen.getDateFromUri (uri);
         Android.Net.Uri updatedUri = WeatherContractOpen.WeatherEntryOpen.buildWeatherLocationWithDate (newLocation, date);
         globalUri = updatedUri;
         LoaderManager.RestartLoader (URL_LOADER, null, this);
     }
 }
开发者ID:Screech129,项目名称:WeatherApp,代码行数:10,代码来源:DetailFragment.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# AndroidApp类代码示例发布时间:2022-05-24
下一篇:
C# Android类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap