Я работал с JSoup в студии android. В моем коде я есть это:JSoup От String до Int
Elements description = document.select("something");
, если я это сделать -
String foo = description.text();
все работает отлично.
Но если я это сделать -
int y = Integer.parseInt(description.text());
Почему мой крах приложения?
Весь мой код:
public Void doInBackground(Void... params) {
try {
// Connect to the web site
Document document = Jsoup
.connect("something")
.userAgent("Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; AS; rv:11.0) like Gecko")
.get();
Elements description = document.select("something");
String foo = description.text();
int fuu = Integer.parseInt(foo);
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
вывесить ошибку. –
wild guess: description.text() не является допустимым целым числом – Reimeus
Попробуйте: Integer.parseInt (description.text(). ToString()); –