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


C# Cursor.getLong方法代码示例

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


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

示例1: pullThumbnails

		private bool pullThumbnails(Cursor imageCursor)
		{
			string data = "";
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final long img_id = imageCursor.getLong(imageCursor.getColumnIndex(android.provider.MediaStore.Images.Media._ID));
			long img_id = imageCursor.getLong(imageCursor.getColumnIndex(MediaStore.Images.Media._ID));
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final android.graphics.Bitmap bm = android.provider.MediaStore.Images.Thumbnails.getThumbnail(getApplicationContext().getContentResolver(), img_id, android.provider.MediaStore.Images.Thumbnails.MICRO_KIND, null);
			Bitmap bm = MediaStore.Images.Thumbnails.getThumbnail(ApplicationContext.ContentResolver, img_id, MediaStore.Images.Thumbnails.MICRO_KIND, null);
			if (bm == null)
			{
				return false;
			}
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final java.io.ByteArrayOutputStream stream = new java.io.ByteArrayOutputStream();
			ByteArrayOutputStream stream = new ByteArrayOutputStream();
			bm.compress(Bitmap.CompressFormat.JPEG, 80, stream);
			data = Base64.encodeToString(stream.toByteArray(), Base64.NO_WRAP);
			try
			{
				stream.close();
			}
//JAVA TO C# CONVERTER WARNING: 'final' catch parameters are not available in C#:
//ORIGINAL LINE: catch (final java.io.IOException e)
			catch (IOException e)
			{
				Console.WriteLine(e.ToString());
				Console.Write(e.StackTrace);
			}
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final long img_size = imageCursor.getLong(imageCursor.getColumnIndex(android.provider.MediaStore.Images.Media.SIZE));
			long img_size = imageCursor.getLong(imageCursor.getColumnIndex(MediaStore.Images.Media.SIZE));
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final String name = imageCursor.getString(imageCursor.getColumnIndex(android.provider.MediaStore.Images.Media.DISPLAY_NAME));
			string name = imageCursor.getString(imageCursor.getColumnIndex(MediaStore.Images.Media.DISPLAY_NAME));
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final int width = imageCursor.getInt(imageCursor.getColumnIndex(android.provider.MediaStore.Images.Media.WIDTH));
			int width = imageCursor.getInt(imageCursor.getColumnIndex(MediaStore.Images.Media.WIDTH));
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final int height = imageCursor.getInt(imageCursor.getColumnIndex(android.provider.MediaStore.Images.Media.HEIGHT));
			int height = imageCursor.getInt(imageCursor.getColumnIndex(MediaStore.Images.Media.HEIGHT));
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final TBModelJson msg = new TBModelJson(img_id, name, data, img_size, width, height);
			ImageFetchModelImpl.TBModelJson msg = new ImageFetchModelImpl.TBModelJson(img_id, name, data, img_size, width, height);
			mTb.Add(msg);
			return true;
		}
开发者ID:moljac,项目名称:Samples.Data.Porting,代码行数:47,代码来源:GalleryProviderService.cs


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