My code is
Button.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View v) {
int cv;
String getmont="",getyear="";
getmont=year.getText().toString();
getyear= (String) sid.getSelectedItem();
SQLiteDatabase db;
db = openOrCreateDatabase("monthapp", MODE_PRIVATE, null);
curtop = db.rawQuery("SELECT SUM(currentpaid)FROM monthvaluesOrgin WHERE curmonth='" + getmont + "' AND curyear='" + getyear + "'", null);
if (curtop.moveToNext() ) {
cv=curtop.getInt(0);
Toast.makeText(getApplicationContext(),cv,Toast.LENGTH_SHORT).show();
}
}
});
How to print/ toast the sum value?
It always shows error EofException
.
My app shows "unfortunately your app has stopped".
Please give me a solution! Thanks in advance!