• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java CursorIndexOutOfBoundsException类的典型用法代码示例

java 11次浏览

本文整理汇总了Java中android.database.CursorIndexOutOfBoundsException的典型用法代码示例。如果您正苦于以下问题:Java CursorIndexOutOfBoundsException类的具体用法?Java CursorIndexOutOfBoundsException怎么用?Java CursorIndexOutOfBoundsException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

CursorIndexOutOfBoundsException类属于android.database包,在下文中一共展示了CursorIndexOutOfBoundsException类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: checkPosition

点赞 2

import android.database.CursorIndexOutOfBoundsException; //导入依赖的package包/类
private void checkPosition() {
    int pos = mInnerCursor.getPosition();
    int count = mInnerCursor.getCount();

    if (-1 == pos || count == pos) {
        throw new CursorIndexOutOfBoundsException(pos, count);
    }
}
 

开发者ID:zom,
项目名称:Zom-Android,
代码行数:9,
代码来源:ConversationView.java

示例2: getDownloadStatus

点赞 2

import android.database.CursorIndexOutOfBoundsException; //导入依赖的package包/类
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);
}
 

开发者ID:svrana,
项目名称:Viz,
代码行数:17,
代码来源:Downloads.java

示例3: getGraphObject

点赞 2

import android.database.CursorIndexOutOfBoundsException; //导入依赖的package包/类
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);
}
 

开发者ID:mmmsplay10,
项目名称:QuizUpWinner,
代码行数:9,
代码来源:SimpleGraphObjectCursor.java

示例4: shouldThrowIndexOutOfBoundsExceptionForInvalidColumnLastRow

点赞 2

import android.database.CursorIndexOutOfBoundsException; //导入依赖的package包/类
@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);
}
 

开发者ID:qx,
项目名称:FullRobolectricTestSample,
代码行数:9,
代码来源:MatrixCursorTest.java

示例5: getGraphObject

点赞 2

import android.database.CursorIndexOutOfBoundsException; //导入依赖的package包/类
@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);
}
 

开发者ID:telerik,
项目名称:platform-friends-android,
代码行数:11,
代码来源:SimpleGraphObjectCursor.java

示例6: getPassword

点赞 2

import android.database.CursorIndexOutOfBoundsException; //导入依赖的package包/类
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;
}
 

开发者ID:sechat,
项目名称:android_chat,
代码行数:14,
代码来源:DataBaseAdapter.java

示例7: getName

点赞 2

import android.database.CursorIndexOutOfBoundsException; //导入依赖的package包/类
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;
}
 

开发者ID:sechat,
项目名称:android_chat,
代码行数:14,
代码来源:DataBaseAdapter.java

示例8: issetUser

点赞 2

import android.database.CursorIndexOutOfBoundsException; //导入依赖的package包/类
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;
}
 

开发者ID:sechat,
项目名称:android_chat,
代码行数:15,
代码来源:DataBaseAdapter.java

示例9: getPublicKey

点赞 2

版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)