java - Integer.parseInt Returns an error: The method parseInt(String) in the type Integer is not applicable for the arguments (R.string) -


i have build array of structures i've built:

the class (item) built following way: (it shown below)

now problem im trying parse string number im getting place (a list in case) int.

but error:

the method parseint(string) in type integer not applicable arguments (r.string)

this piece of code: (it says error in ("integer.parseint"):

markers.add(new item(integer.parseint(items.get(0).get(i)), items.get(1).get(i), items.get(2).get(i), items.get(3).get(i), integer.parseint(items.get(4).get(i)), integer.parseint(items.get(5).get(i)))); 

its long not complicated.

thanks lot!

edit:

the items list list of lists:

list<list<string>> items; 

and structure of class is:

private int id; private string title; private string desc; private string pub; private int p; private int n; 

the code:

public list<list<string>> download()     {         string data = null;         //string res = "";         try {             client = new defaulthttpclient();// reference internet             httppost = new httppost(url);             httpresponse response = client.execute(httppost);             httpentity entity = response.getentity();// content of                                                         // message             inputstream webs = entity.getcontent();              bufferedreader in = new bufferedreader(new inputstreamreader(webs,"iso-8859-1"));              stringbuffer sb = new stringbuffer("");              string l = " ";             // string nl=system.getproperty("line.separator");             while ((l = in.readline()) != null) {                 sb.append(l + "\n");             }             data = sb.tostring();             webs.close();              list<list<string>> all= new arraylist<list<string>>();             all.add(new arraylist<string>());             all.add(new arraylist<string>());             all.add(new arraylist<string>());             all.add(new arraylist<string>());             all.add(new arraylist<string>());             all.add(new arraylist<string>());             all.add(new arraylist<string>());              try {                  jsonobject json = new jsonobject(data);                 jsonarray jarray = json.getjsonarray("item");                 (int = 0; < jarray.length(); i++) {                      jsonobject json_data = jarray.getjsonobject(i);                     //res += json_data.getstring("title")+"\n";                     all.get(0).add(json_data.getstring("id"));                 }                 (int = 0; < jarray.length(); i++) {                      jsonobject json_data = jarray.getjsonobject(i);                     //res += json_data.getstring("title")+"\n";                     all.get(0).add(json_data.getstring("title"));                  }                 (int = 0; < jarray.length(); i++) {                      jsonobject json_data = jarray.getjsonobject(i);                     //res += json_data.getstring("title")+"\n";                     all.get(0).add(json_data.getstring("desc"));                  }                 (int = 0; < jarray.length(); i++) {                      jsonobject json_data = jarray.getjsonobject(i);                     //res += json_data.getstring("title")+"\n";                     all.get(0).add(json_data.getstring("pub"));                  }                 (int = 0; < jarray.length(); i++) {                      jsonobject json_data = jarray.getjsonobject(i);                     //res += json_data.getstring("title")+"\n";                     all.get(0).add(json_data.getstring("p"));                  }                 (int = 0; < jarray.length(); i++) {                      jsonobject json_data = jarray.getjsonobject(i);                     //res += json_data.getstring("title")+"\n";                     all.get(0).add(json_data.getstring("n"));                  }                  return all;              } catch (jsonexception e) {              }              //return news;         } catch (exception e) {             int x=3;             // todo: handle exception         }          return null;     } 

change code, use string insted string.

 private int id;  private string title;  private string desc;   private string pub;  private int p;  private int n; 

also change list

list<list<string>> items; 

Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -