List of usage examples for android.database Cursor getShort
short getShort(int columnIndex);
From source file:org.thomnichols.android.gmarks.WebViewCookiesDB.java
List<Cookie> getCookies() { List<Cookie> cookies = new ArrayList<Cookie>(); SQLiteDatabase db = openDatabase(SQLiteDatabase.OPEN_READONLY); if (db == null) return cookies; try {//from w w w . j ava2s . c om db.execSQL("PRAGMA read_uncommitted = true;"); Cursor cursor = db.query(TABLE_NAME, COLUMNS, null, null, null, null, null); while (cursor.moveToNext()) { BasicClientCookie c = new BasicClientCookie(cursor.getString(COL_NAME), cursor.getString(COL_VALUE)); c.setDomain(cursor.getString(COL_DOMAIN)); c.setPath(cursor.getString(COL_PATH)); Long expiry = cursor.getLong(COL_EXPIRES); if (expiry != null) c.setExpiryDate(new Date(expiry)); c.setSecure(cursor.getShort(COL_SECURE) == 1); Log.d(TAG, "Got cookie: " + c.getName()); cookies.add(c); } cursor.close(); // cursor = db.query(TABLE_NAME, new String[] {"count(name)"}, null, null, null, null, null); // cursor.moveToFirst(); // Log.d("WEBVIEW DB QUERY", "COunt: " + cursor.getLong(0) ); // cursor.close(); return cookies; } finally { db.close(); } }
From source file:org.mariotaku.twidere.adapter.CursorStatusesAdapter.java
@Override public void bindView(final View view, final Context context, final Cursor cursor) { final int position = cursor.getPosition(); final StatusViewHolder holder = (StatusViewHolder) view.getTag(); final boolean is_gap = cursor.getShort(mIndices.is_gap) == 1; final boolean show_gap = is_gap && !mGapDisallowed && position != getCount() - 1; holder.setShowAsGap(show_gap);/*from w w w . j a v a 2s . co m*/ if (!show_gap) { final long account_id = cursor.getLong(mIndices.account_id); final long user_id = cursor.getLong(mIndices.user_id); final long status_id = cursor.getLong(mIndices.status_id); final long status_timestamp = cursor.getLong(mIndices.status_timestamp); final long retweet_count = cursor.getLong(mIndices.retweet_count); final String retweeted_by_name = cursor.getString(mIndices.retweeted_by_name); final String retweeted_by_screen_name = cursor.getString(mIndices.retweeted_by_screen_name); final String text = cursor.getString(mIndices.text_html); final String screen_name = cursor.getString(mIndices.screen_name); final String name = cursor.getString(mIndices.name); final String in_reply_to_screen_name = cursor.getString(mIndices.in_reply_to_screen_name); final String account_screen_name = getAccountScreenName(mContext, account_id); final boolean is_favorite = cursor.getShort(mIndices.is_favorite) == 1; final boolean is_protected = cursor.getShort(mIndices.is_protected) == 1; final boolean is_verified = cursor.getShort(mIndices.is_verified) == 1; final boolean has_location = !TextUtils.isEmpty(cursor.getString(mIndices.location)); final boolean is_retweet = !TextUtils.isEmpty(retweeted_by_name) && cursor.getShort(mIndices.is_retweet) == 1; final boolean is_reply = !TextUtils.isEmpty(in_reply_to_screen_name) && cursor.getLong(mIndices.in_reply_to_status_id) > 0; final boolean is_mention = text.toLowerCase().contains('@' + account_screen_name.toLowerCase()); final boolean is_my_status = account_id == user_id; if (mMultiSelectEnabled) { holder.setSelected(mSelectedStatusIds.contains(status_id)); } else { holder.setSelected(false); } holder.setUserColor(getUserColor(mContext, user_id)); if (text != null) { holder.setHighlightColor(getStatusBackground(mMentionsHighlightDisabled ? false : is_mention, is_favorite, is_retweet)); } holder.setAccountColorEnabled(mShowAccountColor); if (mShowAccountColor) { holder.setAccountColor(getAccountColor(mContext, account_id)); } final PreviewImage preview = getPreviewImage(text, mInlineImagePreviewDisplayOption); final boolean has_media = preview != null ? preview.has_image : false; holder.setTextSize(mTextSize); holder.setIsMyStatus(is_my_status && !mIndicateMyStatusDisabled); if (mLinkHighlightingEnabled) { holder.text.setText(Html.fromHtml(text)); final TwidereLinkify linkify = new TwidereLinkify(holder.text); linkify.setOnLinkClickListener(new OnLinkClickHandler(context, account_id)); linkify.addAllLinks(); } else { holder.text.setText(toPlainText(text)); } holder.text.setMovementMethod(null); holder.name.setCompoundDrawablesWithIntrinsicBounds(0, 0, getUserTypeIconRes(is_verified, is_protected), 0); switch (mNameDisplayOption) { case NAME_DISPLAY_OPTION_CODE_NAME: { holder.name.setText(name); holder.screen_name.setText(null); holder.screen_name.setVisibility(View.GONE); break; } case NAME_DISPLAY_OPTION_CODE_SCREEN_NAME: { holder.name.setText("@" + screen_name); holder.screen_name.setText(null); holder.screen_name.setVisibility(View.GONE); break; } default: { holder.name.setText(name); holder.screen_name.setText("@" + screen_name); holder.screen_name.setVisibility(View.VISIBLE); break; } } if (mShowAbsoluteTime) { holder.time.setText(formatSameDayTime(context, status_timestamp)); } else { holder.time.setText(getRelativeTimeSpanString(status_timestamp)); } holder.time.setCompoundDrawablesWithIntrinsicBounds(0, 0, getStatusTypeIconRes(is_favorite, has_location, has_media), 0); holder.reply_retweet_status.setVisibility(is_retweet || is_reply ? View.VISIBLE : View.GONE); if (is_retweet) { if (mNameDisplayOption == NAME_DISPLAY_OPTION_CODE_SCREEN_NAME) { holder.reply_retweet_status.setText(retweet_count > 1 ? mContext.getString(R.string.retweeted_by_with_count, retweeted_by_screen_name, retweet_count - 1) : mContext.getString(R.string.retweeted_by, retweeted_by_screen_name)); } else { holder.reply_retweet_status.setText(retweet_count > 1 ? mContext.getString(R.string.retweeted_by_with_count, retweeted_by_name, retweet_count - 1) : mContext.getString(R.string.retweeted_by, retweeted_by_name)); } holder.reply_retweet_status.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_indicator_retweet, 0, 0, 0); } else if (is_reply) { holder.reply_retweet_status .setText(mContext.getString(R.string.in_reply_to, in_reply_to_screen_name)); holder.reply_retweet_status.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_indicator_reply, 0, 0, 0); } if (mDisplayProfileImage) { final String profile_image_url = cursor.getString(mIndices.profile_image_url); mProfileImageLoader.displayImage(holder.my_profile_image, profile_image_url); mProfileImageLoader.displayImage(holder.profile_image, profile_image_url); holder.profile_image.setTag(position); holder.my_profile_image.setTag(position); } else { holder.profile_image.setVisibility(View.GONE); holder.my_profile_image.setVisibility(View.GONE); } final boolean has_preview = mInlineImagePreviewDisplayOption != INLINE_IMAGE_PREVIEW_DISPLAY_OPTION_CODE_NONE && has_media && preview.matched_url != null; holder.image_preview_frame.setVisibility(has_preview ? View.VISIBLE : View.GONE); if (has_preview) { final MarginLayoutParams lp = (MarginLayoutParams) holder.image_preview_frame.getLayoutParams(); if (mInlineImagePreviewDisplayOption == INLINE_IMAGE_PREVIEW_DISPLAY_OPTION_CODE_LARGE) { lp.width = LayoutParams.MATCH_PARENT; lp.leftMargin = 0; holder.image_preview_frame.setLayoutParams(lp); } else if (mInlineImagePreviewDisplayOption == INLINE_IMAGE_PREVIEW_DISPLAY_OPTION_CODE_SMALL) { lp.width = mResources.getDimensionPixelSize(R.dimen.image_preview_width); lp.leftMargin = (int) (mResources.getDisplayMetrics().density * 16); holder.image_preview_frame.setLayoutParams(lp); } final boolean is_possibly_sensitive = cursor.getInt(mIndices.is_possibly_sensitive) == 1; if (is_possibly_sensitive && !mDisplaySensitiveContents) { holder.image_preview.setImageResource(R.drawable.image_preview_nsfw); } else { mPreviewImageLoader.displayImage(holder.image_preview, preview.matched_url); } holder.image_preview_frame.setTag(position); } } super.bindView(view, context, cursor); }
From source file:org.mariotaku.twidere.adapter.ParcelableStatusesAdapter.java
@Override public boolean isGapItem(int position) { int dataPosition = position - getStatusStartIndex(); final int statusCount = getStatusCount(); if (dataPosition < 0 || dataPosition >= statusCount) return false; // Don't show gap if it's last item if (dataPosition == statusCount - 1) return false; if (mData instanceof ObjectCursor) { final Cursor cursor = ((ObjectCursor) mData).getCursor(); if (!cursor.moveToPosition(dataPosition)) return false; final ParcelableStatusCursorIndices indices = (ParcelableStatusCursorIndices) ((ObjectCursor) mData) .getIndices();//from w ww . ja va 2s . c o m return cursor.getShort(indices.is_gap) == 1; } return mData.get(dataPosition).is_gap; }
From source file:fr.eoit.activity.loader.InvestItemsLoader.java
private static SparseItemBeanArray getInvestParentBlueprint(Context context, long itemId) { SparseItemBeanArray items = new SparseItemBeanArray(); final Cursor cursor = context.getContentResolver() .query(ContentUris.withAppendedId(Blueprint.CONTENT_ITEM_ID_URI_BASE, itemId), new String[] { Blueprint._ID, Blueprint.COLUMN_NAME_NAME, Blueprint.COLUMN_NAME_PARENT_TYPE_ID, Blueprint.COLUMN_NAME_TECH_LEVEL, Blueprint.COLUMN_NAME_DECRYPTOR_ID }, null, null, null);/* ww w.ja v a 2 s . c o m*/ try { if (DbUtil.hasAtLeastOneRow(cursor)) { ItemBeanWithMaterials item = new ItemBeanWithMaterials(); item.id = cursor.getInt(cursor.getColumnIndexOrThrow(Blueprint._ID)); item.name = cursor.getString(cursor.getColumnIndexOrThrow(Blueprint.COLUMN_NAME_NAME)); //item.price = PricesUtils.getPriceOrNaN(cursor); item.quantity = 1; //item.chosenPriceId = cursor.getShort(cursor.getColumnIndexOrThrow(Item.COLUMN_NAME_CHOSEN_PRICE_ID)); item.volume = Double.NaN; items.append(item); int techLevel = cursor.getInt(cursor.getColumnIndexOrThrow(Blueprint.COLUMN_NAME_TECH_LEVEL)); int parentTypeId = cursor .getInt(cursor.getColumnIndexOrThrow(Blueprint.COLUMN_NAME_PARENT_TYPE_ID)); int decryptorId = cursor.getInt(cursor.getColumnIndexOrThrow(Blueprint.COLUMN_NAME_DECRYPTOR_ID)); if (techLevel == 2) { final Cursor cursorDataInterface = context.getContentResolver().query( ContentUris.withAppendedId(Blueprint.CONTENT_ID_URI_INVENTION_BASE, parentTypeId), new String[] { "i." + Item._ID + " AS " + Item._ID, ItemMaterials.COLUMN_NAME_QUANTITY, Item.COLUMN_NAME_CHOSEN_PRICE_ID, Item.COLUMN_NAME_NAME, Prices.COLUMN_NAME_BUY_PRICE, Prices.COLUMN_NAME_SELL_PRICE, Prices.COLUMN_NAME_OWN_PRICE, Prices.COLUMN_NAME_PRODUCE_PRICE }, null, new String[] { decryptorId == 0 ? null : String.valueOf(decryptorId) }, "i." + Item._ID + " ASC"); try { if (DbUtil.hasAtLeastOneRow(cursorDataInterface)) { while (!cursorDataInterface.isAfterLast()) { item = new ItemBeanWithMaterials(); item.id = cursorDataInterface .getInt(cursorDataInterface.getColumnIndexOrThrow(Item._ID)); item.name = cursorDataInterface.getString( cursorDataInterface.getColumnIndexOrThrow(Item.COLUMN_NAME_NAME)); item.price = PricesUtils.getPriceOrNaN(cursorDataInterface); item.quantity = 1; item.chosenPriceId = cursorDataInterface.getShort(cursorDataInterface .getColumnIndexOrThrow(Item.COLUMN_NAME_CHOSEN_PRICE_ID)); item.volume = Double.NaN; if (EOITConst.Invention.DATA_INTERFACE_IDS.contains((long) item.id)) items.append(item); cursorDataInterface.moveToNext(); } } } finally { cursorDataInterface.close(); } } } } finally { cursor.close(); } return items; }
From source file:de.azapps.mirakel.model.list.ListMirakel.java
/** * Create a List from a Cursor//from ww w .j av a2s .c om * * @param c cursor */ public ListMirakel(final Cursor c) { super(c.getLong(c.getColumnIndex(ID)), c.getString(c.getColumnIndex(NAME)), SORT_BY.fromShort(c.getShort(c.getColumnIndex(SORT_BY_FIELD))), c.getString(c.getColumnIndex(DatabaseHelper.CREATED_AT)), c.getString(c.getColumnIndex(DatabaseHelper.UPDATED_AT)), SYNC_STATE.valueOf(c.getShort(c.getColumnIndex(DatabaseHelper.SYNC_STATE_FIELD))), c.getInt(c.getColumnIndex(LFT)), c.getInt(c.getColumnIndex(RGT)), c.getInt(c.getColumnIndex(COLOR)), c.getInt(c.getColumnIndex(ACCOUNT_ID))); }
From source file:org.mariotaku.twidere.adapter.ParcelableActivitiesAdapter.java
@Override public boolean isGapItem(int adapterPosition) { int dataPosition = adapterPosition - getActivityStartIndex(); final int activityCount = getActivityCount(); if (dataPosition < 0 || dataPosition >= activityCount) return false; // Don't show gap if it's last item if (dataPosition == activityCount - 1) { return false; }/*w w w .j a v a 2 s.c o m*/ if (mData instanceof ObjectCursor) { final Cursor cursor = ((ObjectCursor) mData).getCursor(); if (!cursor.moveToPosition(dataPosition)) return false; final ParcelableActivityCursorIndices indices = (ParcelableActivityCursorIndices) ((ObjectCursor) mData) .getIndices(); return cursor.getShort(indices.is_gap) == 1; } return mData.get(dataPosition).is_gap; }
From source file:cz.tsystems.portablecheckin.MainActivity.java
private void setPalivoSpinner() { Cursor cursor = app.getPaliva(); final int columnIndex = cursor.getColumnIndex("FUEL_ID"); final int fuelId = app.getCheckin().fuel_id; int pos = -1; while (!cursor.isAfterLast()) { pos++;//www.ja va2s . co m if (cursor.getInt(columnIndex) == fuelId) break; cursor.moveToNext(); } final SimpleCursorAdapter adapter = new SimpleCursorAdapter(getActivity(), android.R.layout.simple_spinner_dropdown_item, cursor, new String[] { "TEXT" }, new int[] { android.R.id.text1 }, 0); spTypPaliva.setAdapter(adapter); spTypPaliva.setSelection(pos, true); spTypPaliva.setOnItemSelectedListener(new OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { ((FragmentPagerActivity) getActivity()).unsavedCheckin(); Cursor c = (Cursor) spTypPaliva.getSelectedItem(); app.getCheckin().fuel_id = c.getShort(c.getColumnIndex("FUEL_ID")); } @Override public void onNothingSelected(AdapterView<?> parent) { } }); }
From source file:com.dwdesign.tweetings.adapter.CursorStatusesAdapter.java
@Override public void bindView(final View view, final Context context, final Cursor cursor) { final int position = cursor.getPosition(); StatusViewHolder holder = (StatusViewHolder) view.getTag(); // Clear images in prder to prevent images in recycled view shown. holder.profile_image.setImageDrawable(null); holder.image_preview.setImageDrawable(null); final boolean is_gap = cursor.getShort(mIndices.is_gap) == 1; final boolean show_gap = is_gap && !mGapDisallowed; holder.setShowAsGap(show_gap);// ww w . ja va2s .c om final long account_id = cursor.getLong(mIndices.account_id); holder.setAccountColorEnabled(mShowAccountColor); if (mShowAccountColor) { holder.setAccountColor(getAccountColor(mContext, account_id)); } if (!show_gap) { final String retweeted_by = mDisplayName ? cursor.getString(mIndices.retweeted_by_name) : cursor.getString(mIndices.retweeted_by_screen_name); final String text = cursor.getString(mIndices.text); final String screen_name = cursor.getString(mIndices.screen_name); final String display_name = mDisplayName ? cursor.getString(mIndices.name) : screen_name; final String name = cursor.getString(mIndices.name); final String in_reply_to_screen_name = cursor.getString(mIndices.in_reply_to_screen_name); final long user_id = cursor.getLong(mIndices.user_id); final long status_id = cursor.getLong(mIndices.status_id); final long status_timestamp = cursor.getLong(mIndices.status_timestamp); final long retweet_count = cursor.getLong(mIndices.retweet_count); final boolean is_favorite = cursor.getShort(mIndices.is_favorite) == 1; final boolean is_protected = cursor.getShort(mIndices.is_protected) == 1; final boolean is_verified = cursor.getShort(mIndices.is_verified) == 1; final boolean has_location = !isNullOrEmpty(cursor.getString(mIndices.location)); final boolean is_retweet = !isNullOrEmpty(retweeted_by) && cursor.getShort(mIndices.is_retweet) == 1; final boolean is_reply = !isNullOrEmpty(in_reply_to_screen_name) && cursor.getLong(mIndices.in_reply_to_status_id) > 0; if (mMultiSelectEnabled) { holder.setSelected(mSelectedStatusIds.contains(status_id)); } else { holder.setSelected(false); } if (!mFastProcessingEnabled) { boolean is_mine = false; if (account_id > 0 && screen_name != null && mContext != null && getAccountUsername(mContext, account_id) != null && getAccountUsername(mContext, account_id).equals(screen_name)) { is_mine = true; } holder.setUserColor(getUserColor(mContext, user_id)); if (text != null) { holder.setHighlightColor( getStatusBackground( mMentionsHighlightDisabled ? false : text.toLowerCase().contains( '@' + getAccountUsername(mContext, account_id).toLowerCase()), is_favorite, is_retweet, is_mine)); } } else { holder.setUserColor(Color.TRANSPARENT); holder.setHighlightColor(Color.TRANSPARENT); } final PreviewImage preview = getPreviewImage(text, mInlineImagePreviewDisplayOption); //final PreviewImage preview = !mFastProcessingEnabled || mDisplayImagePreview ? getPreviewImage(text, //mDisplayImagePreview) : null; final boolean has_media = preview != null ? preview.has_image : false; holder.setTextSize(mTextSize); if (mShowLinks) { holder.text.setText(Html.fromHtml(text)); final TwidereLinkify linkify = new TwidereLinkify(holder.text); linkify.setOnLinkClickListener(new OnLinkClickHandler(context, account_id)); linkify.addAllLinks(); } else { holder.text.setText(unescape(text)); } holder.text.setMovementMethod(null); /*if (mShowLinks) { holder.text.setText(TwidereLinkify.twitterifyText(account_id, mContext, text)); holder.text.setMovementMethod(LinkMovementMethod.getInstance()); holder.text.setLinksClickable(false); holder.text.setTag(position); holder.text.setOnClickListener(this); holder.text.setOnLongClickListener(this); } else { holder.text.setText(unescape(text)); }*/ //holder.name.setCompoundDrawablesWithIntrinsicBounds(getUserTypeIconRes(is_verified, is_protected), 0, 0, 0); if (mDisplayNameBoth) { holder.name.setText(name); if (holder.name2 != null) { holder.name2.setText("@" + screen_name); } } else { holder.name.setText(display_name); } if (holder.name2 != null) { holder.name2.setVisibility(mDisplayNameBoth ? View.VISIBLE : View.GONE); } if (mShowAbsoluteTime) { holder.time.setText(formatSameDayTime(context, status_timestamp)); } else { holder.time.setText(getRelativeTimeSpanString(status_timestamp)); } holder.time.setCompoundDrawablesWithIntrinsicBounds(0, 0, getStatusTypeIconRes(is_favorite, has_location, has_media), 0); holder.reply_retweet_status.setVisibility(is_retweet || is_reply ? View.VISIBLE : View.GONE); if (is_retweet) { holder.reply_retweet_status.setText(retweet_count > 1 ? mContext.getString(R.string.retweeted_by_with_count, retweeted_by, retweet_count - 1) : mContext.getString(R.string.retweeted_by, retweeted_by)); holder.reply_retweet_status.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_indicator_retweet, 0, 0, 0); } else if (is_reply) { holder.reply_retweet_status .setText(mContext.getString(R.string.in_reply_to, in_reply_to_screen_name)); holder.reply_retweet_status.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_indicator_reply, 0, 0, 0); } holder.profile_image.setVisibility(mDisplayProfileImage ? View.VISIBLE : View.GONE); if (mDisplayProfileImage) { final String profile_image_url_string = cursor.getString(mIndices.profile_image_url); if (mDisplayHiResProfileImage) { mLazyImageLoader.displayProfileImage(holder.profile_image, getBiggerTwitterProfileImage(profile_image_url_string)); } else { mLazyImageLoader.displayProfileImage(holder.profile_image, profile_image_url_string); } holder.profile_image.setTag(position); } final boolean has_preview = mInlineImagePreviewDisplayOption != INLINE_IMAGE_PREVIEW_DISPLAY_OPTION_CODE_NONE && has_media && preview.matched_url != null; holder.image_preview_frame.setVisibility(has_preview ? View.VISIBLE : View.GONE); if (has_preview) { final MarginLayoutParams lp = (MarginLayoutParams) holder.image_preview_frame.getLayoutParams(); if (mInlineImagePreviewDisplayOption == INLINE_IMAGE_PREVIEW_DISPLAY_OPTION_CODE_LARGE || mInlineImagePreviewDisplayOption == INLINE_IMAGE_PREVIEW_DISPLAY_OPTION_CODE_LARGE_HIGH) { lp.width = LayoutParams.MATCH_PARENT; lp.leftMargin = 0; holder.image_preview_frame.setLayoutParams(lp); } else if (mInlineImagePreviewDisplayOption == INLINE_IMAGE_PREVIEW_DISPLAY_OPTION_CODE_SMALL) { final Resources res = mContext.getResources(); lp.width = res.getDimensionPixelSize(R.dimen.image_preview_width); lp.leftMargin = (int) (mDensity * 16); holder.image_preview_frame.setLayoutParams(lp); } final boolean is_possibly_sensitive = cursor.getInt(mIndices.is_possibly_sensitive) == 1; if (is_possibly_sensitive && !mDisplaySensitiveContents) { holder.image_preview.setImageResource(R.drawable.image_preview_nsfw); } else { mLazyImageLoader.displayPreviewImage(holder.image_preview, preview.matched_url); } holder.image_preview_frame.setTag(position); } } super.bindView(view, context, cursor); }
From source file:org.robobees.recyclerush.PitStatsRR.java
@Override public void fromCursor(Cursor c, DB db, SQLiteDatabase database) { super.fromCursor(c, db, database); push_tote = c.getInt(c.getColumnIndexOrThrow(SCOUT_PIT_DATA_2015_Entry.COLUMN_NAME_PUSH_TOTE)) != 0; push_bin = c.getInt(c.getColumnIndexOrThrow(SCOUT_PIT_DATA_2015_Entry.COLUMN_NAME_PUSH_BIN)) != 0; lift_tote = c.getInt(c.getColumnIndexOrThrow(SCOUT_PIT_DATA_2015_Entry.COLUMN_NAME_LIFT_TOTE)) != 0; lift_bin = c.getInt(c.getColumnIndexOrThrow(SCOUT_PIT_DATA_2015_Entry.COLUMN_NAME_LIFT_BIN)) != 0; push_litter = c.getInt(c.getColumnIndexOrThrow(SCOUT_PIT_DATA_2015_Entry.COLUMN_NAME_PUSH_LITTER)) != 0; load_litter = c.getInt(c.getColumnIndexOrThrow(SCOUT_PIT_DATA_2015_Entry.COLUMN_NAME_LOAD_LITTER)) != 0; stack_tote_height = c .getShort(c.getColumnIndexOrThrow(SCOUT_PIT_DATA_2015_Entry.COLUMN_NAME_STACK_TOTE_HEIGHT)); stack_bin_height = c//w w w . j a v a 2s .c o m .getShort(c.getColumnIndexOrThrow(SCOUT_PIT_DATA_2015_Entry.COLUMN_NAME_STACK_BIN_HEIGHT)); coop_totes = c.getInt(c.getColumnIndexOrThrow(SCOUT_PIT_DATA_2015_Entry.COLUMN_NAME_COOP_TOTES)) != 0; coop_stack_height = c .getShort(c.getColumnIndexOrThrow(SCOUT_PIT_DATA_2015_Entry.COLUMN_NAME_COOP_STACK_HEIGHT)); move_auto = c.getInt(c.getColumnIndexOrThrow(SCOUT_PIT_DATA_2015_Entry.COLUMN_NAME_MOVE_AUTO)) != 0; auto_bin_score = c.getShort(c.getColumnIndexOrThrow(SCOUT_PIT_DATA_2015_Entry.COLUMN_NAME_AUTO_BIN_SCORE)); auto_tote_score = c .getShort(c.getColumnIndexOrThrow(SCOUT_PIT_DATA_2015_Entry.COLUMN_NAME_AUTO_TOTE_SCORE)); auto_tote_stack_height = c .getShort(c.getColumnIndexOrThrow(SCOUT_PIT_DATA_2015_Entry.COLUMN_NAME_AUTO_TOTE_STACK_HEIGHT)); auto_step_bins = c.getShort(c.getColumnIndexOrThrow(SCOUT_PIT_DATA_2015_Entry.COLUMN_NAME_AUTO_STEP_BINS)); manipulation_description = c .getString(c.getColumnIndexOrThrow(SCOUT_PIT_DATA_2015_Entry.COLUMN_NAME_MANIP_STYLE)); need_upright_tote = c .getInt(c.getColumnIndexOrThrow(SCOUT_PIT_DATA_2015_Entry.COLUMN_NAME_NEED_UPRIGHT_TOTE)) != 0; need_upright_bin = c .getInt(c.getColumnIndexOrThrow(SCOUT_PIT_DATA_2015_Entry.COLUMN_NAME_NEED_UPRIGHT_BIN)) != 0; can_upright_tote = c .getInt(c.getColumnIndexOrThrow(SCOUT_PIT_DATA_2015_Entry.COLUMN_NAME_CAN_UPRIGHT_TOTE)) != 0; can_upright_bin = c .getInt(c.getColumnIndexOrThrow(SCOUT_PIT_DATA_2015_Entry.COLUMN_NAME_CAN_UPRIGHT_BIN)) != 0; }
From source file:ru.gkpromtech.exhibition.db.Table.java
private void fillFieldValue(int type, Field field, Object entity, Cursor cursor, int i) throws IllegalAccessException { if (cursor.isNull(i)) { field.set(entity, null);//from w w w .j av a2 s.c o m return; } switch (type) { case INTEGER: field.set(entity, cursor.getInt(i)); break; case SHORT: field.set(entity, cursor.getShort(i)); break; case LONG: field.set(entity, cursor.getLong(i)); break; case FLOAT: field.set(entity, cursor.getFloat(i)); break; case DOUBLE: field.set(entity, cursor.getDouble(i)); break; case STRING: field.set(entity, cursor.getString(i)); break; case BYTE_ARRAY: field.set(entity, cursor.getBlob(i)); break; case DATE: field.set(entity, new Date(cursor.getLong(i))); break; case BOOLEAN: field.set(entity, cursor.getInt(i) != 0); break; } }