Guest User

New Error

a guest
Nov 3rd, 2012
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.97 KB | None | 0 0
  1. Thread [<11> Thread-99] (Suspended (exception ViewRootImpl$CalledFromWrongThreadException))
  2. <VM does not provide monitor information>
  3. ViewRootImpl.checkThread() line: 4039
  4. ViewRootImpl.requestLayout() line: 709
  5. PhoneWindow$DecorView(View).requestLayout() line: 12675
  6. LinearLayout(View).requestLayout() line: 12675
  7. FrameLayout(View).requestLayout() line: 12675
  8. RelativeLayout(View).requestLayout() line: 12675
  9. RelativeLayout.requestLayout() line: 268
  10. TextView(View).requestLayout() line: 12675
  11. TextView.checkForRelayout() line: 6773
  12. TextView.setText(CharSequence, TextView$BufferType, boolean, int) line: 3306
  13. TextView.setText(CharSequence, TextView$BufferType) line: 3162
  14. TextView.setText(CharSequence) line: 3137
  15. MainActivity.updateUI(String) line: 69
  16. MainActivity.access$2(MainActivity, String) line: 67
  17. MainActivity$1.run() line: 45
  18. ------------------------------------------------
  19. It says "Source not found" in ViewRootImpl.checkThread() line:4039
  20.  
  21. ------------------------------------------------
  22.  
  23. code:
  24.  
  25. Thread getInformation = new Thread() {
  26. public void run() {
  27. Document doc;
  28. try {
  29. doc = dereference("my url");
  30. String text = extractContent(doc);
  31. updateUI(text);
  32. } catch (IOException e) {
  33. e.printStackTrace();
  34. }
  35.  
  36. }
  37. };
  38.  
  39. public void ButtonClick(View view) throws IOException {
  40. getInformation.start();
  41. }
  42.  
  43. private Document dereference(String uri) throws IOException {
  44. Connection connection = Jsoup.connect(uri);
  45. return connection.get();
  46. }
  47.  
  48. private String extractContent(Document doc) {
  49. Elements divs = doc.select("div.onlinestatus");
  50. return divs.text();
  51. }
  52.  
  53. private void updateUI(String text) {
  54. TextView tv = (TextView)findViewById(R.id.textView1);
  55. tv.setText(text);
  56. }
Advertisement
Add Comment
Please, Sign In to add comment