2013-01-22 68 views
-3

在我的Android应用程序中,我使用asynctask从网站获取html源代码。 对于我使用HttpURLConnection的那样:为什么我只能获得一半的html源代码?

protected Void doInBackground(Void... v) { 
    try { 
     URL url = new URL("http://xx.com/test.pl"); 
     HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection(); 
     InputStream inputStream = httpURLConnection.getInputStream(); 

     BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream)); 

     String temp; 
     while ((temp = bufferedReader.readLine()) != null) { 
      //Pattern pattern = Pattern.compile("&sid=(.*?)\""); 
      //Matcher match = pattern.matcher(temp); 

      System.out.println(temp); 

      Log.e("temp_HoleKunde", temp); 
     } 
    } 
    catch(Exception exe) { 
     exe.printStackTrace(); 
    } 
    return null; 
} 

我一直用这个,当我分析一个网站,它始终运行太棒了。 但现在我有一个非常严重的问题。我登录logcat的源代码不是完整的源代码。只有一半显示..或更多,有时更少。 如何在浏览器上获得完整的源代码?

回答

1

日志并不打算输出数千行代码。我确定它会在您将其设置为TextView后显示整个源代码。

+0

是的。容易和正确的答案...大声笑非常“有用”LogCat: -/ – StefMa

+0

@StefanM。这是非常有用的,当你不试图将它用于它从未设计的目的。如果logcat接受任意大量的文本,您是否考虑过设计影响? Logcat不用于显示输出。 – Simon

相关问题