开发者

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()

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜