Display data sequencely from DB in android
<p>i need to retrieve data from SQLite &amp; display it sequencely.For ex.if im having 6 rows as "Tn","KR","KN","PJ","DL","HD".Firstly i need to display "TN","KR" as list.If i click next button.,"KN","PJ"should be displayed that replaces old 2..Again when i click next button.,"DL","HD"should be displayed that also replace old 2.</p>

<p>My code..</p>

<pre><code>DBAdapter db = new DBAdapter(this);

  @Override 

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.sub);
       // list = getListView();
        bt=(Button)findViewById(R.id.category);
        prev=(Button)findViewById(R.id.prev);
        next=(Button)findViewById(R.id.next);

        bt.setOnClickListener(new View.OnClickListener() {
             public void onClick(View v) {


                first();


        }
        });
        next.setOnClickListener(new View.OnClickListener() {
             public void onClick(View v) {


                second();

        }
        });
        prev.setOnClickListener(new View.OnClickListener() {
             public void onClick(View v) {


                first();

        }
        });


  }


        private void first() {

             db.open();

                //db.insertTitle("Money");
               // db.insertTitle("make");
               // db.insertTitle("Anythings");
                //db.insertTitle("in the world");
             //db.insertTitle("Common");
             //db.insertTitle("To all");

            results.clear();
                Cursor c = db.getAllRecords(1,2);

                if (c.moveToFirst())
                {
                    do {          
                          String firstName = c.getString(c.getColumnIndex("user"));
                          results.add( firstName );
                       } while (c.moveToNext());
                }


                setListAdapter(new ArrayAdapter&lt;String&gt;(this,
                        android.R.layout.simple_list_item_1,
                        results));

                db.close();
               // c.requery();

        }
        private void second() {
             db.open();

               Cursor c = db.getAllRecords(2,2);
               results.clear();
                if (c.moveToFirst())
                {
                    do {          
                          String firstName = c.getString(c.getColumnIndex("user"));
                          results.add( firstName );
                       } while (c.moveToNext());
                }
                setListAdapter(new ArrayAdapter&lt;String&gt;(this,
                        android.R.layout.simple_list_item_1,
                        results));

                db.close();
               // c.requery();

        }
</code></pre>

<p>Initially it displays "Tn","KR".When i click next.,it shows "KN","PJ" as list well.But i donno how to display "DL","HD" when i click next again.</p>
