Hi guys im new on android development maybe its a easy question but im stuck on it pls help. Its my class. and i cannot cast Uretimyeri to string. How can i do this.
private String Oid; private String MalzemeGrubu; private String Musteri; private UretimYeriBean UretimYeri; private String Model; private Integer Tipi; private Integer Durum; private String OzelKod; private String Adi; private String Kodu;
UretimYeriBean is
private String Oid;
private Integer Tipi;
private Integer Durum;
private String OzelKod;
private String Adi;
private String Kodu;
And here my get list func.
public List<MalzemeBean> getList() {
List<MalzemeBean> liste = new ArrayList<MalzemeBean>();
SQLiteDatabase db = Global.DB.getReadableDatabase();
String selectQuery = "Select Oid,MalzemeGrubu,Musteri,UretimYeri,Model,Tipi,Durum,OzelKod,Adi,Kodu"
+ " FROM " + TABLE_NAME + " Order by Ad COLLATE UNICODE";
Cursor c = db.rawQuery(selectQuery, null);
if (c.moveToFirst()) {
do {
MalzemeBean mlz = new MalzemeBean();
mlz.setOid(c.getString(c.getColumnIndex("Oid")));
mlz.setMalzemeGrubu(c.getString(c.getColumnIndex("MalzemeGrubu")));
mlz.setMusteri(c.getString(c.getColumnIndex("Musteri")));
mlz.setUretimYeri(c.getString(c.getColumnIndex("UretimYeri")));
mlz.setModel(c.getString(c.getColumnIndex("Model")));
mlz.setTipi(c.getInt(c.getColumnIndex("Tipi")));
mlz.setDurum(c.getInt(c.getColumnIndex("Durum")));
mlz.setOzelKod(c.getString(c.getColumnIndex("OzelKod")));
mlz.setAdi(c.getString(c.getColumnIndex("Adi")));
mlz.setKodu(c.getString(c.getColumnIndex("Kodu")));
liste.add(mlz);
} while (c.moveToNext());
}
c.close();
return liste;
}
ıts give me error on mlz.setUretimYeri(c.getString(c.getColumnIndex("UretimYeri"))); line , and says Error:(57, 46) error: incompatible types: String cannot be converted to UretimYeriBean. So how i can convert Uretimyeri.Oid to string
Aucun commentaire:
Enregistrer un commentaire