Cursor going out of bound
I have a scenerio in which i have to move the cursor to next and previous. I am runing into exception when the cursor is already at the first or last location, then it throws out of bound exception.
How to tackle this situation ? What is the best way to handle it and currently i am handling it with exception [try and catch].
public boolean nextWord()
{
boolean isVald = false;
try
{
i开发者_运维问答sVald = currentCursor.moveToNext();
fillCurrentWord();
} catch (Exception e)
{
Log.e("nextWord", e.toString());
}
return isVald;
}
if (!currentCursor.isLast()){
currentCursor.moveToNext();
// ...
}
You can verify your current position using one of the following methods: isFirst()
, isBeforeFirst()
, isLast()
or isAfterLast()
精彩评论