android - How to insert object in a spinner -
i want know how can put spinner in activity filled values of object.
i used spinners with:
sp_usage.setonitemselectedlistener(new adapterview.onitemselectedlistener() { public void onitemselected(adapterview<?> parent, view view, int pos, long id) { object item = parent.getitematposition(pos); } public void onnothingselected(adapterview<?> parent) { } });
the case receive array of object server items id , name. want know how can know item selected, need resend id server.
note: ids received haven't sequences, 1,23,47...
i uses object:
public class usages { @key public string idd; @key public string msgerror; @key public string usage; public string getidd() { return idd; } public void setidd(string idd) { this.idd = idd; } public string getmsgerror() { return msgerror; } public void setmsgerror(string msgerror) { this.msgerror = msgerror; } public string getusages() { return usage; } public void setusages(string usages) { this.usage = usage; } @override public string tostring() { return "usages{" + "idd='" + idd + '\'' + ", msgerror='" + msgerror + '\'' + ", usage='" + usage + '\'' + '}'; } }
thanks
Comments
Post a Comment