java - My TextView to display an array isn't working? -
in app have method designed put new string string array in first empty index. designed display array in textbox has ten lines. reason, not working. have used log display array contents in logcat, not appearing. thought i'd come here , ask if can see obvious errors cause not work? if need more details, such class array used, let me know! :)
the method:
string playerinvtemp[] = theplayer.getplayerinv(); (int i=0; < playerinvtemp.length; i++) { if ((!playerinvtemp[i].isempty()) || playerinvtemp[i] == null) { theplayer.setplayerinv("torch", i); log.i(tag,theplayer.getplayerinv(1)); playerinvtemp = theplayer.getplayerinv(); log.i(tag,playerinvtemp[1]); stringbuilder builder = new stringbuilder(); (string s : playerinvtemp) { builder.append(s + " "); invtext.settext(builder.tostring()); } break; } }
- it bad practice change array iterating on inside loop.
probably, have array of empty strings, in case condition:
((!playerinvtemp[i].isempty()) || playerinvtemp[i] == null)
remains false. maybe meant:
(!(playerinvtemp[i].isempty() || playerinvtemp[i] == null))
Comments
Post a Comment