android - ORMLite get single database column -
i'm trying use sql command ormlite:
select address receive
with code:
list<receivers> receiver_address = receiverdao.querybuilder().selectcolumns("address").query();
but object returned is:
1 = {receivers@830028192208} address = {string@830028192264} "my new address" city = null email = null telephone = null mobile = null name_family = null national_code = null postal_code = null receiver_name = null id = 2
i need address
field in query without iterator
such as:
list<string> list = new arraylist<string>(); for( receivers lst:receiver_address) list.add(lst.getaddress());
how action?
you can use rawrowmapper here:
list<string> addresses = receiverdao.queryraw("select address receive", new rawrowmapper<string>() { @override public string maprow(string[] columnnames, string[] resultcolumns) throws sqlexception { return resultcolumns[0]; } }).getresults();