InputStream返回libcore.net.http.fixedlengthinputstream

时间:2014-02-07 18:47:45

标签: java android inputstream

我不知道libcore.net.http.fixedlengthinputstream的含义是什么,如何解决它以获取实际的字符串。请帮帮我。以下是我的代码。

private void fetchHomeScreenData() {
    Log.wtf("SidePlease", "inside fetch...");  
    ConnectivityManager connMgr = (ConnectivityManager) 
            getSystemService(Context.CONNECTIVITY_SERVICE);
    NetworkInfo networkInfo = connMgr.getActiveNetworkInfo();
    if (networkInfo != null && networkInfo.isConnected()) {
        new Thread(new Runnable() {

            @Override
            public void run() {
                try{
                    URL url = new URL(AppConstants.homeUrl);
                    HttpURLConnection connection = (HttpURLConnection) url.openConnection();
                    InputStream is = connection.getInputStream();
                    Log.wtf("SP", is.toString());
                }catch(Exception e){
                    Log.wtf("SidePlease", e.toString());
                }
            }
        }).start();

    } else {
        AlertDialog.Builder alert = new AlertDialog.Builder(SidePlease.this);
        alert.setTitle("SidePlease").setMessage("You are currently not connected to the intenet. Please check your network setting and try again.")
        .setNeutralButton("Okay", null).show();
    }

}

0 个答案:

没有答案