I have a table having two columns - name and symbol. all i want is to get the symbol corresponding to the name. I use this method. It's kind of returning nothing. Please check this out.
public String getSymbol(String name) {
String Symbol = "";
String[] columns = new String[] { "name", "symbol" };
Cursor c = getReadableDatabase().query(DATABASE_TABLE_NAME, columns, null,
null, null, null, null);
int iName = c.getColumnIndex("name");
int iSymbol = c.getColumnIndex("symbol");
for (c.moveToFirst(); !c.isAfterLast(); c.moveToNext()) {
if (c.getString(iName) == name) {
Symbol = Symbol + c.getString(iSymbol);
}
}
return Symbol;
}