0

i m following New Boston Android Series.and In HttpClinet Tutorial I m getting Problmem ,not getting data from the website . I have checked on Both Device and Emulator Getting SAme Issue i need the output the source code for the current page I have posted The logcat.. please help.

LogCat :

    03-10 07:31:58.612: E/StrictMode(721):  at android.app.LoadedApk$ServiceDispatcher.<init>(LoadedApk.java:969)
03-10 07:31:58.612: E/StrictMode(721):  at android.app.LoadedApk.getServiceDispatcher(LoadedApk.java:863)
03-10 07:31:58.612: E/StrictMode(721):  at android.app.ContextImpl.bindService(ContextImpl.java:1418)
03-10 07:31:58.612: E/StrictMode(721):  at android.app.ContextImpl.bindService(ContextImpl.java:1407)
03-10 07:31:58.612: E/StrictMode(721):  at android.content.ContextWrapper.bindService(ContextWrapper.java:473)
03-10 07:31:58.612: E/StrictMode(721):  at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:157)
03-10 07:31:58.612: E/StrictMode(721):  at com.android.emailcommon.service.ServiceProxy.setTask(ServiceProxy.java:145)
03-10 07:31:58.612: E/StrictMode(721):  at com.android.emailcommon.service.ServiceProxy.test(ServiceProxy.java:191)
03-10 07:31:58.612: E/StrictMode(721):  at com.android.exchange.ExchangeService$7.run(ExchangeService.java:1850)
03-10 07:31:58.612: E/StrictMode(721):  at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:551)
03-10 07:31:58.612: E/StrictMode(721):  at com.android.emailcommon.utility.Utility$2.doInBackground(Utility.java:549)
03-10 07:31:58.612: E/StrictMode(721):  at android.os.AsyncTask$2.call(AsyncTask.java:287)
03-10 07:31:58.612: E/StrictMode(721):  at java.util.concurrent.FutureTask.run(FutureTask.java:234)
03-10 07:31:58.612: E/StrictMode(721):  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
03-10 07:31:58.612: E/StrictMode(721):  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
03-10 07:31:58.612: E/StrictMode(721):  at java.lang.Thread.run(Thread.java:856)
03-10 07:31:58.612: W/ActivityManager(286): Unbind failed: could not find connection for android.os.BinderProxy@41714bd0

GetMethodEx class

   package com.ss;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URI;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;

import android.net.Uri;

public class GetMethodEx {

    // method return a strign from twitter

    public String getInternetData() throws Exception {

        BufferedReader in = null;
        String data = null;
        try {
            HttpClient client = new DefaultHttpClient();
            URI website = new URI("https://www.forbes.com");
            HttpGet reuest = new HttpGet();
            reuest.setURI(website);
            System.out.println(website.toString()+"-----------");
            HttpResponse response = client.execute(reuest);
            System.out.println(response.toString()+"response ");

            in = new BufferedReader(new InputStreamReader(response.getEntity()
                    .getContent()));
            StringBuffer sb = new StringBuffer("");
            String line = "";
            String newLine = System.getProperty("line.separator");
            while ((line = in.readLine()) != null) {
                sb.append(line + newLine);

            }
            in.close();
            data = sb.toString();
            return data;
        } catch (Exception e) {
            // TODO: handle exception
            e.printStackTrace();
        } finally {
            try {
                if (in != null) {
                    in.close();
                    return data;
                }
            } catch (Exception e) {
                // TODO: handle exception

                e.printStackTrace();
                return data;
            }
        }
        return data;
    }

}
Divya
  • 1,469
  • 1
  • 13
  • 25
  • http://stackoverflow.com/questions/13765122/android-emulator-spams-logcat-with-service-com-android-exchange-exchangeservice – Tim Mar 09 '15 at 13:58
  • website from where your trying to get information is not available anymore, try to change url – Pankaj Nimgade Mar 10 '15 at 07:03
  • i have tried with 10 website still not getting data..i have changed the logcat .can you please help – Divya Mar 10 '15 at 07:34

0 Answers0