开发者

Android SQLite reading raws with wait time

I have a small problem I'm using SQLite and my problem is that when I run the program the code reads all the rows in the table. How can I make it to read 1 then delay and read the next then delay?

Note: delay = 5 sec for example.

//---get all titles---
db.open();
Cursor c = db.getAllTitles();
if (c.moveToFirst())
{
    do 
    {          
        DisplayTitle(c);
    } while (c.moveToNext());
}
db.close();

This is how I display them:

public void DisplayTitle(Cursor c)
{
    Toast.makeText(this,
            "id: " + c.getString(0) + "\n" +
                    &q开发者_C百科uot;ISBN: " + c.getString(1) + "\n" +
                    "TITLE: " + c.getString(2) + "\n" +
                    "PUBLISHER:  " + c.getString(3),
            Toast.LENGTH_LONG).show();
}


Have a look at the accepted answer in this post for an idea on how to use a Handler to create a pseudo loop that calls itself repeated on a delay. It shouldn't be too hard to implement something similar for your needs.

android substuting the click with a timer

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜