android - Java iterator nested List -
i have simple class structure :
public class messageslist { private int id; private int msg_id; }
for , set data database,o'm using code :
list<messageslist> item = g.dbhelper.getrawrow("select * messageslist group msg_id");
to query database, result is:
item = {arraylist@830033903920} size = 2 0 = {string[14]@830033903944} 0 = {string@830033904024} "1" 1 = {string@830033904080} "1" 1 = {string[14]@830033905064} 0 = {string@830033905144} "2" 1 = {string@830033905200} "2"
now i'm trying iterator nested list :
(int i=0;i<item.size();i++) { log.e("",item.get(i).getid()+""); }
i error , app dont work, how iterator nested list? thanks
error:
java.lang.classcastexception: java.lang.string[] cannot cast ir.tsms.eitaapro.helper.database.models.messageslist
the problem here
list<messageslist> item = g.dbhelper.getrawrow("select * messageslist group msg_id");
string object coming database.
solution: length of data , 1 one. :
list<messageslist> item=new arraylist<>(); for(int i=0;i yourdatalength;i++) { item.add( messagelist data database); }
Comments
Post a Comment