Lets say i had a a button that cycles through numbers how can i store the number but if the next array is displayed then delete the previous entry so on so on and so on. When i keep on pressing the button it diplays 1, 2 , 3 but i want it to show a single value.
Code example:
final CharSequence[] items = {"1", "2", "3"};
if (value < items.length) {
String s = (String)items[value];
sqlName.setText(s);
String sRow1 = sqlName.getText().toString();
long lRow1 = Long.parseLong(sRow1);
HotOrNot ex1 = new HotOrNot(this);
ex1.open();
ex1.deleteEntry(lRow1);
ex1.close();
}
String name = sqlName.getText().toString();
HotOrNot entry = new HotOrNot(SQLiteExample.this);
entry.open();
entry.createEntry(name);
entry.close();
}
I don’t follow; can you restate the question? What I am gathering is that you wish to display “1”, then when the button is pressed, display “2” and so on.
Further:
looks like it can be shortened to
String sRow1 = sas you are getting the very string you just used.