i am trying to pass some values in to a function and compare some values and get the array list.
calling the Collect function in Dbhand class.
TextView result = (TextView) findViewById(R.id.textviewres);
result.setText(dbhand.collect(
getIntent().getExtras().getString("temple_type"),
getIntent().getExtras().getString("notemples"))
);
collect() Function in dbhand class.
public String collect(String temptype, String limit){
SQLiteDatabase ourDatabase = this.getWritableDatabase();
String result="";
String []column =new String[]{KEY_ID,KEY_TMPNAME,KEY_TMPTYPE,KEY_LATITUDE,KEY_LONGITUDE,KEY_IMGNAME,KEY_YEARBUILD,KEY_ADDRESS,KEY_CITY,KEY_EMAIL,KEY_WEB,KEY_TEL1,KEY_TEL2,KEY_DESCRI};
Cursor c=ourDatabase.query("templ", column, null, null, null, null,null, limit);
c.moveToFirst();
int iKEY_ID = c.getColumnIndex(KEY_ID);
int iKEY_TMPNAME= c.getColumnIndex(KEY_TMPNAME);
int iKEY_TMPTYPE= c.getColumnIndex(KEY_TMPTYPE);
for (c.moveToFirst();!c.isAfterLast();c.moveToNext()){
if (c.getString(iKEY_TMPTYPE) == temptype){
result = result+c.getString(iKEY_ID)+"\t\t"+c.getString(iKEY_TMPNAME)+"\t\t"+c.getString(iKEY_TMPTYPE)+" \n";
}
}
return result;
}
i didn't get any error, since the if condition is not compared. it does not return any value.
can anyone help me to fix this plz.