Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Thread [<11> Thread-99] (Suspended (exception ViewRootImpl$CalledFromWrongThreadException))
- <VM does not provide monitor information>
- ViewRootImpl.checkThread() line: 4039
- ViewRootImpl.requestLayout() line: 709
- PhoneWindow$DecorView(View).requestLayout() line: 12675
- LinearLayout(View).requestLayout() line: 12675
- FrameLayout(View).requestLayout() line: 12675
- RelativeLayout(View).requestLayout() line: 12675
- RelativeLayout.requestLayout() line: 268
- TextView(View).requestLayout() line: 12675
- TextView.checkForRelayout() line: 6773
- TextView.setText(CharSequence, TextView$BufferType, boolean, int) line: 3306
- TextView.setText(CharSequence, TextView$BufferType) line: 3162
- TextView.setText(CharSequence) line: 3137
- MainActivity.updateUI(String) line: 69
- MainActivity.access$2(MainActivity, String) line: 67
- MainActivity$1.run() line: 45
- ------------------------------------------------
- It says "Source not found" in ViewRootImpl.checkThread() line:4039
- ------------------------------------------------
- code:
- Thread getInformation = new Thread() {
- public void run() {
- Document doc;
- try {
- doc = dereference("my url");
- String text = extractContent(doc);
- updateUI(text);
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- };
- public void ButtonClick(View view) throws IOException {
- getInformation.start();
- }
- private Document dereference(String uri) throws IOException {
- Connection connection = Jsoup.connect(uri);
- return connection.get();
- }
- private String extractContent(Document doc) {
- Elements divs = doc.select("div.onlinestatus");
- return divs.text();
- }
- private void updateUI(String text) {
- TextView tv = (TextView)findViewById(R.id.textView1);
- tv.setText(text);
- }
Advertisement
Add Comment
Please, Sign In to add comment