在这里,我尝试使用一个Web服务。我试图将该Web服务的json数据显示到android中的listview中?但我在我的logcat上遇到错误,如下面
logcat的
03-18 18:11:51.830: I/System.out(296): Transparent 17170445
03-18 18:11:51.990: W/System.err(296): java.net.SocketException: Permission denied
03-18 18:11:52.000: W/System.err(296): at org.apache.harmony.luni.platform.OSNetworkSystem.createStreamSocketImpl(Native Method)
03-18 18:11:52.000: W/System.err(296): at org.apache.harmony.luni.platform.OSNetworkSystem.createStreamSocket(OSNetworkSystem.java:186)
03-18 18:11:52.000: W/System.err(296): at org.apache.harmony.luni.net.PlainSocketImpl.create(PlainSocketImpl.java:265)
03-18 18:11:52.000: W/System.err(296): at java.net.Socket.checkClosedAndCreate(Socket.java:873)
03-18 18:11:52.010: W/System.err(296): at java.net.Socket.connect(Socket.java:1020)
03-18 18:11:52.010: W/System.err(296): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection.<init>(HttpConnection.java:62)
03-18 18:11:52.010: W/System.err(296): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnectionPool.get(HttpConnectionPool.java:88)
03-18 18:11:52.010: W/System.err(296): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.getHTTPConnection(HttpURLConnectionImpl.java:927)
03-18 18:11:52.010: W/System.err(296): at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:909)
03-18 18:11:52.010: W/System.err(296): at org.ksoap2.transport.ServiceConnectionSE.connect(ServiceConnectionSE.java:76)
03-18 18:11:52.010: W/System.err(296): at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:146)
03-18 18:11:52.010: W/System.err(296): at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:95)
03-18 18:11:52.010: W/System.err(296): at com.example.png.StationsListActivity.callService(StationsListActivity.java:97)
03-18 18:11:52.010: W/System.err(296): at com.example.png.StationsListActivity$3.run(StationsListActivity.java:78)
03-18 18:11:52.429: D/AndroidRuntime(296): Shutting down VM
03-18 18:11:52.429: W/dalvikvm(296): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
03-18 18:11:52.449: E/AndroidRuntime(296): FATAL EXCEPTION: main
03-18 18:11:52.449: E/AndroidRuntime(296): java.lang.NullPointerException
03-18 18:11:52.449: E/AndroidRuntime(296): at com.example.png.StationsListActivity$1.handleMessage(StationsListActivity.java:43)
03-18 18:11:52.449: E/AndroidRuntime(296): at android.os.Handler.dispatchMessage(Handler.java:99)
03-18 18:11:52.449: E/AndroidRuntime(296): at android.os.Looper.loop(Looper.java:123)
03-18 18:11:52.449: E/AndroidRuntime(296): at android.app.ActivityThread.main(ActivityThread.java:4627)
03-18 18:11:52.449: E/AndroidRuntime(296): at java.lang.reflect.Method.invokeNative(Native Method)
3-18 18:11:52.449: E/AndroidRuntime(296): at java.lang.reflect.Method.invoke(Method.java:521)
03-18 18:11:52.449: E/AndroidRuntime(296): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
03-18 18:11:52.449: E/AndroidRuntime(296): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
03-18 18:11:52.449: E/AndroidRuntime(296): at dalvik.system.NativeStart.main(Native Method)
谢谢你宝贵的时间!..
答案 0 :(得分:3)
您是否在manifest.xml
添加了以下权限?
<uses-permission android:name="android.permission.INTERNET" />
答案 1 :(得分:0)
向您的清单添加Internet权限:
<uses-permission android:name="android.permission.INTERNET"/>
答案 2 :(得分:0)
请为您的manifest.xml文件添加互联网权限。
<uses-permission android:name="android.permission.INTERNET"/>