java中的HtmlHelper库 - 找不到源代码

时间:2014-06-20 17:56:33

标签: java android eclipse

请帮助我在我的java方法onItemClick中发现错误。当我在try-catch构造中注释所有代码时 - 程序运行,但在其他情况下 - 程序崩溃并出现错误" Source not found"。我更喜欢,错误从 hh = new HtmlHelper(new URL((String) url))string开始。

@Override
                   public void onItemClick(AdapterView<?> adapter, View view, int position, long arg) 
                   {
                      String stringData;
                      Intent intent = new Intent(StackParser.this, AvailableContent.class);
                      url = (String) mURLs.get(output.get(position));
                      Toast.makeText(getApplicationContext(), url, Toast.LENGTH_SHORT).show();
                      HtmlHelper hh;
                      try 
                      {
                        hh = new HtmlHelper(new URL((String) url));
                        TimeUnit.SECONDS.sleep(5);
                        List<TagNode> links = hh.getLinksByClass("texts");
                        Iterator<TagNode> iterator = links.iterator();
                        iterator.hasNext();
                        TagNode divElement = (TagNode) iterator.next();
                        stringData = divElement.getText().toString();
                        if(!stringData.equals(""))
                        {
                            intent.putExtra("Send to the content-activity", stringData);
                            startActivity(intent);
                            finish();
                        }
                        else
                        {
                            intent.putExtra("Send to the content-activity", "empty");
                            startActivity(intent);
                            finish();
                        }
                      } 
                      catch (MalformedURLException e) 
                      {
                        Toast.makeText(getApplicationContext(), "1", Toast.LENGTH_SHORT).show();
                      // TODO Auto-generated catch block
                        e.printStackTrace();
                      } 
                      catch (IOException e) 
                      {
                        Toast.makeText(getApplicationContext(), "2", Toast.LENGTH_SHORT).show();  
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                      }
                      catch (InterruptedException e) 
                      {
                        e.printStackTrace();
                      }
                   }
                });

0 个答案:

没有答案