zoukankan      html  css  js  c++  java
  • NetworkOnMainThreadException


    引起问题的 部分   加入线程中运行

    new Thread(new Runnable() {
    
    			@Override
    			public void run() {
    				// TODO Auto-generated method stub
    				 
    			}
    		}).start();






    NetworkOnMainThreadException

    02-25 14:50:57.420: E/AndroidRuntime(16377): android.os.NetworkOnMainThreadException
    02-25 14:50:57.420: E/AndroidRuntime(16377): at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1128)
    02-25 14:50:57.420: E/AndroidRuntime(16377): at java.net.InetAddress.lookupHostByName(InetAddress.java:385)
    02-25 14:50:57.420: E/AndroidRuntime(16377): at java.net.InetAddress.getAllByNameImpl(InetAddress.java:236)
    02-25 14:50:57.420: E/AndroidRuntime(16377): at java.net.InetAddress.getAllByName(InetAddress.java:214)
    02-25 14:50:57.420: E/AndroidRuntime(16377): at libcore.net.http.HttpConnection.<init>(HttpConnection.java:70)
    02-25 14:50:57.420: E/AndroidRuntime(16377): at libcore.net.http.HttpConnection.<init>(HttpConnection.java:50)
    02-25 14:50:57.420: E/AndroidRuntime(16377): at libcore.net.http.HttpConnection$Address.connect(HttpConnection.java:340)
    02-25 14:50:57.420: E/AndroidRuntime(16377): at libcore.net.http.HttpConnectionPool.get(HttpConnectionPool.java:87)
    02-25 14:50:57.420: E/AndroidRuntime(16377): at libcore.net.http.HttpConnection.connect(HttpConnection.java:128)
    02-25 14:50:57.420: E/AndroidRuntime(16377): at libcore.net.http.HttpEngine.openSocketConnection(HttpEngine.java:315)
    02-25 14:50:57.420: E/AndroidRuntime(16377): at libcore.net.http.HttpEngine.connect(HttpEngine.java:310)
    02-25 14:50:57.420: E/AndroidRuntime(16377): at libcore.net.http.HttpEngine.sendSocketRequest(HttpEngine.java:289)
    02-25 14:50:57.420: E/AndroidRuntime(16377): at libcore.net.http.HttpEngine.sendRequest(HttpEngine.java:239)
    02-25 14:50:57.420: E/AndroidRuntime(16377): at libcore.net.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:80)
    02-25 14:50:57.420: E/AndroidRuntime(16377): at java.net.URLConnection.getContent(URLConnection.java:190)
    02-25 14:50:57.420: E/AndroidRuntime(16377): at java.net.URL.getContent(URL.java:447)
    02-25 14:50:57.420: E/AndroidRuntime(16377): at com.huashang.huishang.utils.AsynImageLoader.loadImageFromUrl(AsynImageLoader.java:62)
    02-25 14:50:57.420: E/AndroidRuntime(16377): at com.huashang.huishang.activity.adapter.PageMessageListAdapter.getView(PageMessageListAdapter.java:97)
    02-25 14:50:57.420: E/AndroidRuntime(16377): at android.widget.AbsListView.obtainView(AbsListView.java:2429)
    02-25 14:50:57.420: E/AndroidRuntime(16377): at android.widget.ListView.makeAndAddView(ListView.java:1769)
    02-25 14:50:57.420: E/AndroidRuntime(16377): at android.widget.ListView.fillDown(ListView.java:672)
    02-25 14:50:57.420: E/AndroidRuntime(16377): at android.widget.ListView.fillFromTop(ListView.java:733)
    02-25 14:50:57.420: E/AndroidRuntime(16377): at android.widget.ListView.layoutChildren(ListView.java:1608)
    02-25 14:50:57.420: E/AndroidRuntime(16377): at android.widget.AbsListView.onLayout(AbsListView.java:2264)
    02-25 14:50:57.420: E/AndroidRuntime(16377): at android.view.View.layout(View.java:13873)
    02-25 14:50:57.420: E/AndroidRuntime(16377): at android.view.ViewGroup.layout(ViewGroup.java:4500)
    02-25 14:50:57.420: E/AndroidRuntime(16377): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1649)
    02-25 14:50:57.420: E/AndroidRuntime(16377): at android.widget.LinearLayout.layoutHorizontal(LinearLayout.java:1638)
    02-25 14:50:57.420: E/AndroidRuntime(16377): at android.widget.LinearLayout.onLayout(LinearLayout.java:1422)
    02-25 14:50:57.420: E/AndroidRuntime(16377): at android.view.View.layout(View.java:13873)
    02-25 14:50:57.420: E/AndroidRuntime(16377): at android.view.ViewGroup.layout(ViewGroup.java:4500)
    02-25 14:50:57.420: E/AndroidRuntime(16377): at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
    02-25 14:50:57.420: E/AndroidRuntime(16377): at android.view.View.layout(View.java:13873)
    02-25 14:50:57.420: E/AndroidRuntime(16377): at android.view.ViewGroup.layout(ViewGroup.java:4500)
    02-25 14:50:57.420: E/AndroidRuntime(16377): at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
    02-25 14:50:57.420: E/AndroidRuntime(16377): at android.view.View.layout(View.java:13873)
    02-25 14:50:57.420: E/AndroidRuntime(16377): at android.view.ViewGroup.layout(ViewGroup.java:4500)
    02-25 14:50:57.420: E/AndroidRuntime(16377): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1649)
    02-25 14:50:57.420: E/AndroidRuntime(16377): at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1507)
    02-25 14:50:57.420: E/AndroidRuntime(16377): at android.widget.LinearLayout.onLayout(LinearLayout.java:1420)
    02-25 14:50:57.420: E/AndroidRuntime(16377): at android.view.View.layout(View.java:13873)
    02-25 14:50:57.420: E/AndroidRuntime(16377): at android.view.ViewGroup.layout(ViewGroup.java:4500)
    02-25 14:50:57.420: E/AndroidRuntime(16377): at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
    02-25 14:50:57.420: E/AndroidRuntime(16377): at android.view.View.layout(View.java:13873)
    02-25 14:50:57.420: E/AndroidRuntime(16377): at android.view.ViewGroup.layout(ViewGroup.java:4500)
    02-25 14:50:57.420: E/AndroidRuntime(16377): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1649)
    02-25 14:50:57.420: E/AndroidRuntime(16377): at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1507)
    02-25 14:50:57.420: E/AndroidRuntime(16377): at android.widget.LinearLayout.onLayout(LinearLayout.java:1420)
    02-25 14:50:57.420: E/AndroidRuntime(16377): at android.view.View.layout(View.java:13873)
    02-25 14:50:57.420: E/AndroidRuntime(16377): at android.view.ViewGroup.layout(ViewGroup.java:4500)
    02-25 14:50:57.420: E/AndroidRuntime(16377): at android.widget.FrameLayout.onLayout(FrameLayout.java:448)
    02-25 14:50:57.420: E/AndroidRuntime(16377): at android.view.View.layout(View.java:13873)
    02-25 14:50:57.420: E/AndroidRuntime(16377): at android.view.ViewGroup.layout(ViewGroup.java:4500)
    02-25 14:50:57.420: E/AndroidRuntime(16377): at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:1941)
    02-25 14:50:57.420: E/AndroidRuntime(16377): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1762)
    02-25 14:50:57.420: E/AndroidRuntime(16377): at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1072)
    02-25 14:50:57.420: E/AndroidRuntime(16377): at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4297)
    02-25 14:50:57.420: E/AndroidRuntime(16377): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:725)
    02-25 14:50:57.420: E/AndroidRuntime(16377): at android.view.Choreographer.doCallbacks(Choreographer.java:555)
    02-25 14:50:57.420: E/AndroidRuntime(16377): at android.view.Choreographer.doFrame(Choreographer.java:525)
    02-25 14:50:57.420: E/AndroidRuntime(16377): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:711)
    02-25 14:50:57.420: E/AndroidRuntime(16377): at android.os.Handler.handleCallback(Handler.java:615)
    02-25 14:50:57.420: E/AndroidRuntime(16377): at android.os.Handler.dispatchMessage(Handler.jav

  • 相关阅读:
    RabbitMQ学习之集群消息可靠性测试
    RabbitMQ学习之集群镜像模式配置
    (转)RabbitMQ学习之集群部署
    RabbitMQ学习之集群模式
    RabbitMQ学习之spring配置文件rabbit标签的使用
    RabbitMQ学习之messageconver插件实现(Gson)
    RabbitMQ学习之基于spring-rabbitmq的RPC远程调用
    RabbitMQ学习之基于spring-rabbitmq的消息异步发送
    (转)RabbitMQ学习之spring整合发送异步消息(注解实现)
    范仁义js课程---16、非bool值的逻辑运算
  • 原文地址:https://www.cnblogs.com/flyingsir/p/3983704.html
Copyright © 2011-2022 走看看