Java 类android.database.CursorIndexOutOfBoundsException 实例源码

项目:Zom-Android    文件:ConversationView.java   
private void checkPosition() {
    int pos = mInnerCursor.getPosition();
    int count = mInnerCursor.getCount();

    if (-1 == pos || count == pos) {
        throw new CursorIndexOutOfBoundsException(pos, count);
    }
}
项目:Viz    文件:Downloads.java   
public VizContract.Downloads.Status getDownloadStatus(int position) {
    Cursor cursor = (Cursor) mAdapter.getItem(position);
    // this is cruft left-over from a previous bug which I do not think
    // exists anymore b/c we no longer remove a Download behind the users
    // back (we used to do this when the download failed)
    if (cursor.getCount() == 0) {
        return VizContract.Downloads.Status.FAILED;
    }
    int statusInt = VizContract.Downloads.Status.FAILED.valueOf();
    try {
        statusInt = cursor.getInt(cursor.getColumnIndex(DownloadsColumns.STATUS));
    } catch(CursorIndexOutOfBoundsException e) {
        Log.w("threw a cursorIndexOfBoundsException");
    }
    return VizContract.Downloads.Status.fromInt(statusInt);
}
项目:QuizUpWinner    文件:SimpleGraphObjectCursor.java   
public T getGraphObject()
{
  if (this.pos < 0)
    throw new CursorIndexOutOfBoundsException("Before first object.");
  if (this.pos >= this.graphObjects.size())
    throw new CursorIndexOutOfBoundsException("After last object.");
  return (GraphObject)this.graphObjects.get(this.pos);
}
项目:FullRobolectricTestSample    文件:MatrixCursorTest.java   
@Test(expected = CursorIndexOutOfBoundsException.class)
public void shouldThrowIndexOutOfBoundsExceptionForInvalidColumnLastRow() throws Exception {
  MatrixCursor cursor = new MatrixCursor(new String[]{"a", "b", "c"});
  cursor.addRow(new Object[]{"foo", 10L, 0.1f});
  cursor.moveToFirst();
  cursor.moveToNext();
  cursor.getString(0);
}
项目:platform-friends-android    文件:SimpleGraphObjectCursor.java   
@Override
public T getGraphObject() {
    if (pos < 0) {
        throw new CursorIndexOutOfBoundsException("Before first object.");
    }
    if (pos >= graphObjects.size()) {
        throw new CursorIndexOutOfBoundsException("After last object.");
    }
    return graphObjects.get(pos);
}
项目:Shorcial    文件:SimpleGraphObjectCursor.java   
@Override
public T getGraphObject() {
    if (pos < 0) {
        throw new CursorIndexOutOfBoundsException("Before first object.");
    }
    if (pos >= graphObjects.size()) {
        throw new CursorIndexOutOfBoundsException("After last object.");
    }
    return graphObjects.get(pos);
}
项目:Team-Alice    文件:SimpleGraphObjectCursor.java   
@Override
public T getGraphObject() {
    if (pos < 0) {
        throw new CursorIndexOutOfBoundsException("Before first object.");
    }
    if (pos >= graphObjects.size()) {
        throw new CursorIndexOutOfBoundsException("After last object.");
    }
    return graphObjects.get(pos);
}
项目:CampusFeedv2    文件:SimpleGraphObjectCursor.java   
@Override
public T getGraphObject() {
    if (pos < 0) {
        throw new CursorIndexOutOfBoundsException("Before first object.");
    }
    if (pos >= graphObjects.size()) {
        throw new CursorIndexOutOfBoundsException("After last object.");
    }
    return graphObjects.get(pos);
}
项目:WatsiAndroidApp    文件:SimpleGraphObjectCursor.java   
@Override
public T getGraphObject() {
    if (pos < 0) {
        throw new CursorIndexOutOfBoundsException("Before first object.");
    }
    if (pos >= graphObjects.size()) {
        throw new CursorIndexOutOfBoundsException("After last object.");
    }
    return graphObjects.get(pos);
}
项目:android_chat    文件:DataBaseAdapter.java   
public String getPassword() {
    SQLiteDatabase db = mDbHelper.getReadableDatabase();
    Cursor cursor = db.query(ThreadHelper.DB_USER_TABLE, new String[] { ThreadHelper.DB_PASSWORD },
            ThreadHelper.DB_ID + "=?", new String[] { "0" }, null, null, null, null);
    if (cursor != null)
        cursor.moveToFirst();
    try {
        return cursor.getString(0);
    } catch (CursorIndexOutOfBoundsException e) {
        if (th.D) Log.d(TAG, e.getMessage());
    }
    return null;
}
项目:android_chat    文件:DataBaseAdapter.java   
public String getName() {
    SQLiteDatabase db = mDbHelper.getReadableDatabase();
    Cursor cursor = db.query(ThreadHelper.DB_USER_TABLE, new String[] { ThreadHelper.DB_NAME },
            ThreadHelper.DB_ID + "=?", new String[] { "0" }, null, null, null, null);
    if (cursor != null)
        cursor.moveToFirst();
    try {
        return cursor.getString(0);
    } catch (CursorIndexOutOfBoundsException e) {
        if (th.D) Log.d(TAG, e.getMessage());
    }
    return null;
}
项目:android_chat    文件:DataBaseAdapter.java   
public boolean issetUser() {
    SQLiteDatabase db = mDbHelper.getReadableDatabase();
    try {
        Cursor cursor = db.query(ThreadHelper.DB_USER_TABLE, new String[] { ThreadHelper.DB_NAME },
                ThreadHelper.DB_ID + "=?", new String[] { "0" }, null, null, null, null);
        if (cursor != null)
            cursor.moveToFirst();
        cursor.getString(0);
        return true;
    } catch (CursorIndexOutOfBoundsException e) {
        if (th.D) Log.d(TAG, e.getMessage());
    }
    return false;
}
项目:android_chat    文件:DataBaseAdapter.java   
public String getPublicKey() {
    String result = null;
    SQLiteDatabase db = mDbHelper.getReadableDatabase();
    Cursor cursor = db.query(ThreadHelper.DB_USER_TABLE, new String[] { ThreadHelper.DB_PUBLIC },
            ThreadHelper.DB_ID + "=?", new String[] { "0" }, null, null, null, null);
    try {
        if (cursor != null)
            cursor.moveToFirst();
        result = cursor.getString(0);
    } catch (CursorIndexOutOfBoundsException e) {
        if (th.D) Log.d(TAG, e.getMessage());
    }
    return result;
}
项目:android_chat    文件:DataBaseAdapter.java   
public String getPrivateKey() {
    String result = null;
    SQLiteDatabase db = mDbHelper.getReadableDatabase();
    Cursor cursor = db.query(ThreadHelper.DB_USER_TABLE, new String[] { ThreadHelper.DB_PRIVATE },
            ThreadHelper.DB_ID + "=?", new String[] { "0" }, null, null, null, null);
    try {
        if (cursor != null)
            cursor.moveToFirst();
        result = cursor.getString(0);
    } catch (CursorIndexOutOfBoundsException e) {
        if (th.D) Log.d(TAG, e.getMessage());
    }
    return result;
}
项目:Qtino.SharingKit    文件:SimpleGraphObjectCursor.java   
@Override
public T getGraphObject() {
    if (pos < 0) {
        throw new CursorIndexOutOfBoundsException("Before first object.");
    }
    if (pos >= graphObjects.size()) {
        throw new CursorIndexOutOfBoundsException("After last object.");
    }
    return graphObjects.get(pos);
}
项目:smartenit    文件:SimpleGraphObjectCursor.java   
@Override
public T getGraphObject() {
    if (pos < 0) {
        throw new CursorIndexOutOfBoundsException("Before first object.");
    }
    if (pos >= graphObjects.size()) {
        throw new CursorIndexOutOfBoundsException("After last object.");
    }
    return graphObjects.get(pos);
}
项目:kaorisan    文件:SimpleGraphObjectCursor.java   
@Override
public T getGraphObject() {
    if (pos < 0) {
        throw new CursorIndexOutOfBoundsException("Before first object.");
    }
    if (pos >= graphObjects.size()) {
        throw new CursorIndexOutOfBoundsException("After last object.");
    }
    return graphObjects.get(pos);
}
项目:maven-multilib-sample-app    文件:SimpleGraphObjectCursor.java   
@Override
public T getGraphObject() {
    if (pos < 0) {
        throw new CursorIndexOutOfBoundsException("Before first object.");
    }
    if (pos >= graphObjects.size()) {
        throw new CursorIndexOutOfBoundsException("After last object.");
    }
    return graphObjects.get(pos);
}
项目:DualRunner    文件:SimpleGraphObjectCursor.java   
@Override
public T getGraphObject() {
    if (pos < 0) {
        throw new CursorIndexOutOfBoundsException("Before first object.");
    }
    if (pos >= graphObjects.size()) {
        throw new CursorIndexOutOfBoundsException("After last object.");
    }
    return graphObjects.get(pos);
}
项目:repay-android    文件:ContactsContractHelper.java   
/**
 * Get the main email address of the contact
 * @param contactID The last known ContactID of the contact
 * @param c The context to run in
 * @return String representation of their email address
 * @throws android.database.CursorIndexOutOfBoundsException
 */
public static HashMap<String,String> getContactsEmailAddress(String contactID, Context c) throws CursorIndexOutOfBoundsException
{
    /*
     * For some shitting reason, using ContactsContract.CommonDataKinds.Phone works instead of Email?
     * Leaving it anyway, might just be some stupid HTC Sense 5 bug
     */
    HashMap<String,String> emails = new HashMap<String,String>();
    for(int i=0;i<=typesEmail.length-1;i++){
        String[] whereArgs = new String[] {String.valueOf(contactID), String.valueOf(typesEmail[i])};
        String email = queryContactForEmail(c, whereArgs);
        if(email!=null){
            if(ContactsContract.CommonDataKinds.Phone.TYPE_HOME==typesEmail[i]){
                emails.put("Home", email);
            }
            else if(ContactsContract.CommonDataKinds.Phone.TYPE_MOBILE==typesEmail[i]){
                emails.put("Other", email);
            }
            else if(ContactsContract.CommonDataKinds.Phone.TYPE_WORK==typesEmail[i]){
                emails.put("Work", email);
            }
        }
    }
    return emails;
}
项目:repay-android    文件:DatabaseHandler.java   
/**
 * Lookup the most recent entry in the database
 * @return Debt representation of most recent debt entered into database
 * @throws java.text.ParseException
 * @throws NullPointerException
 * @throws android.database.sqlite.SQLiteException
 * @throws android.database.CursorIndexOutOfBoundsException
 */
public Debt getMostRecentDebt() throws ParseException, NullPointerException, SQLiteException,
        CursorIndexOutOfBoundsException{
    SQLiteDatabase db = getReadableDatabase();
    Cursor c;
    c = db.query(Names.D_TABLENAME, null, null, null, null, null, null);
    c.moveToLast();
    SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT);
    db.close();
    return new Debt(c.getInt(0), c.getString(1), sdf.parse(c.getString(2)),
            new BigDecimal(c.getString(2)), c.getString(3));
}
项目:p2psafety    文件:SimpleGraphObjectCursor.java   
@Override
public T getGraphObject() {
    if (pos < 0) {
        throw new CursorIndexOutOfBoundsException("Before first object.");
    }
    if (pos >= graphObjects.size()) {
        throw new CursorIndexOutOfBoundsException("After last object.");
    }
    return graphObjects.get(pos);
}
项目:ConvertItAll    文件:Currency.java   
@Override
protected String doInBackground(String... sUrl) {
    sqliteHelper = new SQLiteOpenHelperCurrency(
            ConverterInterface.thisContext);

    String[] code = new String[1];
    db = sqliteHelper.getReadableDatabase();
    Cursor cursor = null;
    try {
        for (int n = 0; n <= currencyCodes.length - 1; n++) {
            for (int k = 0; k <= currencyCodes.length - 1; k++) {
                code[0] = String.valueOf(n * (currencyCodes.length) + k
                        + 1);
                cursor = db.rawQuery(
                        "SELECT currency from currencies WHERE _id=?",
                        code);
                cursor.moveToFirst();
                currencies[n][k] = Double.valueOf(cursor
                        .getString(cursor.getColumnIndex("currency")));
                cursor.close();
            }
        }
    } catch (CursorIndexOutOfBoundsException e) {
        Converter.CurrencyDatabase.delete();
    } finally {
        if (cursor != null)
            cursor.close();
    }

    publishProgress(0);
    return null;
}
项目:ShopAfter    文件:SimpleGraphObjectCursor.java   
@Override
public T getGraphObject() {
    if (pos < 0) {
        throw new CursorIndexOutOfBoundsException("Before first object.");
    }
    if (pos >= graphObjects.size()) {
        throw new CursorIndexOutOfBoundsException("After last object.");
    }
    return graphObjects.get(pos);
}
项目:MeNextAndroid    文件:SimpleGraphObjectCursor.java   
@Override
public T getGraphObject() {
    if (pos < 0) {
        throw new CursorIndexOutOfBoundsException("Before first object.");
    }
    if (pos >= graphObjects.size()) {
        throw new CursorIndexOutOfBoundsException("After last object.");
    }
    return graphObjects.get(pos);
}
项目:MisterWok    文件:SimpleGraphObjectCursor.java   
@Override
public T getGraphObject() {
    if (pos < 0) {
        throw new CursorIndexOutOfBoundsException("Before first object.");
    }
    if (pos >= graphObjects.size()) {
        throw new CursorIndexOutOfBoundsException("After last object.");
    }
    return graphObjects.get(pos);
}
项目:CanYouSinkMe    文件:SimpleGraphObjectCursor.java   
@Override
public T getGraphObject() {
    if (pos < 0) {
        throw new CursorIndexOutOfBoundsException("Before first object.");
    }
    if (pos >= graphObjects.size()) {
        throw new CursorIndexOutOfBoundsException("After last object.");
    }
    return graphObjects.get(pos);
}
项目:ClassParticipation2    文件:SimpleGraphObjectCursor.java   
@Override
public T getGraphObject() {
    if (pos < 0) {
        throw new CursorIndexOutOfBoundsException("Before first object.");
    }
    if (pos >= graphObjects.size()) {
        throw new CursorIndexOutOfBoundsException("After last object.");
    }
    return graphObjects.get(pos);
}
项目:ClassParticipation2    文件:SimpleGraphObjectCursor.java   
@Override
public T getGraphObject() {
    if (pos < 0) {
        throw new CursorIndexOutOfBoundsException("Before first object.");
    }
    if (pos >= graphObjects.size()) {
        throw new CursorIndexOutOfBoundsException("After last object.");
    }
    return graphObjects.get(pos);
}
项目:Klyph    文件:SimpleGraphObjectCursor.java   
@Override
public T getGraphObject() {
    if (pos < 0) {
        throw new CursorIndexOutOfBoundsException("Before first object.");
    }
    if (pos >= graphObjects.size()) {
        throw new CursorIndexOutOfBoundsException("After last object.");
    }
    return graphObjects.get(pos);
}
项目:Wabbit-Messenger---android-client    文件:SimpleGraphObjectCursor.java   
@Override
public T getGraphObject() {
    if (pos < 0) {
        throw new CursorIndexOutOfBoundsException("Before first object.");
    }
    if (pos >= graphObjects.size()) {
        throw new CursorIndexOutOfBoundsException("After last object.");
    }
    return graphObjects.get(pos);
}
项目:LostAndFound    文件:SimpleGraphObjectCursor.java   
@Override
public T getGraphObject() {
    if (pos < 0) {
        throw new CursorIndexOutOfBoundsException("Before first object.");
    }
    if (pos >= graphObjects.size()) {
        throw new CursorIndexOutOfBoundsException("After last object.");
    }
    return graphObjects.get(pos);
}
项目:UbiNomadLib    文件:SimpleGraphObjectCursor.java   
@Override
public T getGraphObject() {
    if (pos < 0) {
        throw new CursorIndexOutOfBoundsException("Before first object.");
    }
    if (pos >= graphObjects.size()) {
        throw new CursorIndexOutOfBoundsException("After last object.");
    }
    return graphObjects.get(pos);
}
项目:Nefete    文件:SimpleGraphObjectCursor.java   
@Override
public T getGraphObject() {
    if (pos < 0) {
        throw new CursorIndexOutOfBoundsException("Before first object.");
    }
    if (pos >= graphObjects.size()) {
        throw new CursorIndexOutOfBoundsException("After last object.");
    }
    return graphObjects.get(pos);
}
项目:PetTinder    文件:SimpleGraphObjectCursor.java   
@Override
public T getGraphObject() {
    if (pos < 0) {
        throw new CursorIndexOutOfBoundsException("Before first object.");
    }
    if (pos >= graphObjects.size()) {
        throw new CursorIndexOutOfBoundsException("After last object.");
    }
    return graphObjects.get(pos);
}
项目:StoryTeller    文件:SimpleGraphObjectCursor.java   
@Override
public T getGraphObject() {
    if (pos < 0) {
        throw new CursorIndexOutOfBoundsException("Before first object.");
    }
    if (pos >= graphObjects.size()) {
        throw new CursorIndexOutOfBoundsException("After last object.");
    }
    return graphObjects.get(pos);
}
项目:barterli_android    文件:SimpleGraphObjectCursor.java   
@Override
public T getGraphObject() {
    if (pos < 0) {
        throw new CursorIndexOutOfBoundsException("Before first object.");
    }
    if (pos >= graphObjects.size()) {
        throw new CursorIndexOutOfBoundsException("After last object.");
    }
    return graphObjects.get(pos);
}
项目:HereAStory-Android    文件:SimpleGraphObjectCursor.java   
@Override
public T getGraphObject() {
    if (pos < 0) {
        throw new CursorIndexOutOfBoundsException("Before first object.");
    }
    if (pos >= graphObjects.size()) {
        throw new CursorIndexOutOfBoundsException("After last object.");
    }
    return graphObjects.get(pos);
}
项目:android-skeleton-project    文件:SimpleGraphObjectCursor.java   
@Override
public T getGraphObject() {
    if (pos < 0) {
        throw new CursorIndexOutOfBoundsException("Before first object.");
    }
    if (pos >= graphObjects.size()) {
        throw new CursorIndexOutOfBoundsException("After last object.");
    }
    return graphObjects.get(pos);
}
项目:FacebookImageShareIntent    文件:SimpleGraphObjectCursor.java   
@Override
public T getGraphObject() {
    if (pos < 0) {
        throw new CursorIndexOutOfBoundsException("Before first object.");
    }
    if (pos >= graphObjects.size()) {
        throw new CursorIndexOutOfBoundsException("After last object.");
    }
    return graphObjects.get(pos);
}