本文整理汇总了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);
};
}
}
示例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");
}
}
}
示例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);
}
示例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;
}
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
}
};
}
示例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);
}
示例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;
}
示例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;
}
示例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);
});
}
示例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();
}
}
示例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();
}
}
}
示例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);
}
}