本文整理汇总了C#中Cursor.getColumnIndex方法的典型用法代码示例。如果您正苦于以下问题:C# Cursor.getColumnIndex方法的具体用法?C# Cursor.getColumnIndex怎么用?C# Cursor.getColumnIndex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cursor
的用法示例。
在下文中一共展示了Cursor.getColumnIndex方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: populateFields
private void populateFields(View v, Cursor c)
{
int nameCol = c.getColumnIndex(Note.TITLE);
int modifiedCol = c.getColumnIndex(Note.MODIFIED_DATE);
int tagCol = c.getColumnIndex(Note.TAGS);
string title = c.GetString(nameCol);
string tags = c.GetString(tagCol);
//Format last modified dates to be similar to desktop Tomboy
//TODO this is messy - must be a better way than having 3 separate date types
Time lastModified = new Time();
lastModified.parse3339(c.GetString(modifiedCol));
Long lastModifiedMillis = lastModified.toMillis(false);
Date lastModifiedDate = new Date(lastModifiedMillis);
string strModified = this.context.GetString(Resource.String.textModified)+" ";
//TODO this is very inefficient
if (DateUtils.isToday(lastModifiedMillis)){
strModified += this.context.GetString(Resource.String.textToday) +", " + localeTimeFormat.format(lastModifiedDate);
} else {
// Add a day to the last modified date - if the date is now today, it means the note was edited yesterday
Time yesterdayTest = lastModified;
yesterdayTest.monthDay += 1;
if (DateUtils.isToday(yesterdayTest.toMillis(false))){
strModified += this.context.GetString(Resource.String.textYexterday) +", " + localeTimeFormat.format(lastModifiedDate);
} else {
strModified += localeDateFormat.format(lastModifiedDate) + ", " + localeTimeFormat.format(lastModifiedDate);
}
}
/**
* Next set the name of the entry.
*/
TextView note_title = (TextView) v.FindViewById(Resource.Id.note_title);
if (note_title != null) {
note_title.SetText(title);
if(tags.contains("system:deleted"))
note_title.setPaintFlags(note_title.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
else
note_title.setPaintFlags(note_title.getPaintFlags() & ~Paint.STRIKE_THRU_TEXT_FLAG);
}
TextView note_modified = (TextView) v.FindViewById(Resource.Id.note_date);
if (note_modified != null) {
note_modified.SetText(strModified);
}
}
示例2: 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;
}