I have connected a database in my Android Application. Now I have created a button and when it is clicked, that should get the next data from the table of database. I have cursor and he moveToFirst() and moveToNext() methods in my code. also I have set onclick listener to my button. but in output when I click the button, its is not fetching the next data from database
heres the part of code where I have tried to set on click listener for button
c=myDbHelper.query(myDbHelper.DB_PATH +"/MainTable",null, null, null, null,null, null);
c.moveToFirst();
myques=(TextView)findViewById(R.id.question);
myrg=(RadioGroup)findViewById(R.id.rg1);
myc1=(RadioButton)findViewById(R.id.radio0);
myc2=(RadioButton)findViewById(R.id.radio1);
myc3=(RadioButton)findViewById(R.id.radio2);
myc4=(RadioButton)findViewById(R.id.radio3);
NxtQues=(Button)findViewById(R.id.button1);
myques.setText(c.getString(1));
myc1.setText(c.getString(2));
myc2.setText(c.getString(3));
myc3.setText(c.getString(4));
myc4.setText(c.getString(5));
NxtQues.setOnClickListener(new OnClickListener()
{
@Override
public void onClick(View V)
{
c.moveToNext();
}
});
what changes should I make in this code to set on click listener in a proper way.