Skip to content Skip to sidebar Skip to footer

Package Has Already Posted 50 Toasts. Not Showing More

Hello I am working on an app and in which at one point I need to take input from user and store it in database and then fetch that data and put it on different TextView. Problem is

Solution 1:

Your while loop i thinks will runs for infinite time. because every time it will be true and you have no break statement. so change your code like this.

try {
    if (AccCursor.moveToFirst()) {
        while (AccCursor.moveToNext()) {
        //code for fetch data from cursor
        }
    }

    AccCursor.close();
}catch (Exception e) {
    Log.e("Getdata", e.getMessage(), e);
}  

Solution 2:

There is some enhancement for the code above. If cursor is in position -1, AccCursor.moveToNext will move it to position 0, so you can do better something like:

try {
    while(AccCursor.moveToNext()) {
        //Execute code
    }
    AccCursor.close();
}catch(finalException lException) {
    Log.e("Getdata", "Exception looping Cursor: " + lException.getMessage());
}

Post a Comment for "Package Has Already Posted 50 Toasts. Not Showing More"