Hi, I'm trying to read a file via http. (http://www-lehre.inf.uos.de/ ~mmenning/balingen.ts). I wrote a Connector Class:
package gip.android.ogl; import java.io.IOException; import java.io.InputStream; import java.net.URL; import android.util.Log; public class DataConnectorTS { private final String DEBUG_TAG = "DataConnectorTS"; public DataConnectorTS() {} public void requestTS(String address) { try { URL url = new URL(address); Log.d(DEBUG_TAG, "url: " + url); Log.d(DEBUG_TAG,"host: "+url.getHost()); readData(url.openStream()); } catch (IOException e) { Log.e(DEBUG_TAG, "JML request IOError", e); } } private void readData(InputStream in){ } } But by trying to connect in the ActivityClass DataConnectorTS dcts= new DataConnectorTS(); dcts.requestTS("http://www-lehre.inf.uos.de/~mmenning/ balingen.jml"); I will only get the following ExceptionTrace: 01-27 17:00:18.605: ERROR/DataConnectorTS(182): JML request IOError 01-27 17:00:18.605: ERROR/DataConnectorTS(182): java.net.UnknownHostException: Host is unresolved: www- lehre.inf.uos.de:80 01-27 17:00:18.605: ERROR/DataConnectorTS(182): at java.net.Socket.connect(Socket.java:928) 01-27 17:00:18.605: ERROR/DataConnectorTS(182): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection.<init> (HttpConnection.java:61) 01-27 17:00:18.605: ERROR/DataConnectorTS(182): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnectionManager $ConnectionPool.getHttpConnection(HttpConnectionManager.java:145) 01-27 17:00:18.605: ERROR/DataConnectorTS(182): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnectionManager.getConnection (HttpConnectionManager.java:67) 01-27 17:00:18.605: ERROR/DataConnectorTS(182): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.getHTTPConnection (HttpURLConnection.java:800) 01-27 17:00:18.605: ERROR/DataConnectorTS(182): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.connect (HttpURLConnection.java:786) 01-27 17:00:18.605: ERROR/DataConnectorTS(182): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.getInputStream (HttpURLConnection.java:1030) 01-27 17:00:18.605: ERROR/DataConnectorTS(182): at java.net.URL.openStream(URL.java:664) 01-27 17:00:18.605: ERROR/DataConnectorTS(182): at gip.android.ogl.DataConnectorTS.requestTS(DataConnectorTS.java:35) 01-27 17:00:18.605: ERROR/DataConnectorTS(182): at gip.android.ogl.FirstOGLApp.onCreate(FirstOGLApp.java:14) 01-27 17:00:18.605: ERROR/DataConnectorTS(182): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java: 1122) 01-27 17:00:18.605: ERROR/DataConnectorTS(182): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java: 2103) 01-27 17:00:18.605: ERROR/DataConnectorTS(182): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java: 2156) 01-27 17:00:18.605: ERROR/DataConnectorTS(182): at android.app.ActivityThread.access$1800(ActivityThread.java:112) 01-27 17:00:18.605: ERROR/DataConnectorTS(182): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1580) 01-27 17:00:18.605: ERROR/DataConnectorTS(182): at android.os.Handler.dispatchMessage(Handler.java:88) 01-27 17:00:18.605: ERROR/DataConnectorTS(182): at android.os.Looper.loop(Looper.java:123) 01-27 17:00:18.605: ERROR/DataConnectorTS(182): at android.app.ActivityThread.main(ActivityThread.java:3742) 01-27 17:00:18.605: ERROR/DataConnectorTS(182): at java.lang.reflect.Method.invokeNative(Native Method) 01-27 17:00:18.605: ERROR/DataConnectorTS(182): at java.lang.reflect.Method.invoke(Method.java:515) 01-27 17:00:18.605: ERROR/DataConnectorTS(182): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:739) 01-27 17:00:18.605: ERROR/DataConnectorTS(182): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:497) 01-27 17:00:18.605: ERROR/DataConnectorTS(182): at dalvik.system.NativeStart.main(Native Method) I already added the uses-permission Internet Tag to the manifest.xml (above the application tag). I can create the URL Instance but not call openStream(). Any Idea what the problem could be? Thanks for any help Mathias --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---