不能把http请求写在主线程里,改为这样

        Runnable runnable = new Runnable() {
public void run() {
HttpClient.post2("Notification posted 通知标题: " + "通知内容:");
}
};
new Thread(runnable).start();

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.autumn.book/com.autumn.book.MainActivity}: android.os.NetworkOnMainThreadException的更多相关文章

  1. 转载java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.spinner/com.example.spinner.MainActivity}: java.lang.NullPointerException

    今天学习Android开发突然遇到了这个问题,查阅了很多资料,并且对集中原因进行了分析. 错误信息字符串:java.lang.RuntimeException: Unable to start act ...

  2. java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.paipaixiu/com.example.paipaixiu.MASetSomeThing}: android.view.InflateException: Binary XML file line #19: Attempt to invo

    这个报错是因为Android布局的控件 <view android:layout_width="match_parent" android:layout_height=&qu ...

  3. Java.lang.RuntimeException: Unable to instantiate activity ComponentInfo

    如果你更新了ADT的新版本,而工程文件中使用了其他的jar包,也可能会出现"java.lang.RuntimeException: Unable to instantiate activit ...

  4. java.lang.RuntimeException: Unable to instantiate activity ComponentInfo异常总结

    java.lang.RuntimeException: Unable to instantiate activity ComponentInfo异常总结 做android开发的可能都碰到"j ...

  5. java.lang.RuntimeException: Unable to start activity ComponentInfo{com.ex.activity/com.ex.activity.LoginActivity}: android.view.InflateException: Binary XML file line #1: Error inflating class

    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.ex.activity/com.ex.activity.L ...

  6. java.lang.RuntimeException: Unable to start activity ComponentInfo

    异常:java.lang.RuntimeException: Unable to start activity ComponentInfo{com.william/com.william.Result ...

  7. java.lang.RuntimeException: Unable to start activity ComponentInfo……AppCompat does not support the current theme features

    Android测试时出现闪退的问题,出现了如下所示异常: java.lang.RuntimeException: Unable to start activity ComponentInfo{thon ...

  8. Android开发中java.lang.RuntimeException: Unable to start activity ComponentInfo{xxx}

    Android开发中java.lang.RuntimeException: Unable to start activity ComponentInfo{xxx}: java.lang.NullPoi ...

  9. android studio调试报错:java.lang.RuntimeException: Unable to start activity ComponentInfo

    报错信息: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.pro_u_loc/com.e ...

  10. java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.love5/com.example.love5.Main11Activity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.

    若有 java.lang.RuntimeException和 java.lang.NullPointerException: Attempt to invoke virtual method 'voi ...

随机推荐

  1. python进程join()函数理解

    Join()是主程序等我这个进程执行完毕了,程序才往下走  

  2. python基础五--dict

    一.昨日内容回顾 1. 列表: 增 insert:按照指定下标插入 append:在列表最后增加 extend:迭代式的增加到列表的最后,相当于列表扩展 删 pop:根据指定下标删除,返回删除的元素, ...

  3. Lombok让pojo变得更优雅

    Lombok 采取注解的形式,标记在pojo上面,在编译后,自动生成相应的方法,像get.set.构造方法等都可以注解一键生成. 引入jar包: <dependency> <grou ...

  4. Charles手机端抓包--证书

    应用测试: Charles通过无线对手机进行抓包 测试系统: ubuntu 16.04 LTS 测试手机: IOS 10.3(14E277) Charles版本: Charles 4.1.4 手机证书 ...

  5. git如何列出分支之间的差异commit

    答:使用git log master..diff_master 这样就可以列出在diff_master分支中包含的commit而在master分支中不包含的commit

  6. centos7 + mysql5.7 tar包解压安装

    #卸载系统自带的Mariadb [root@hdp265dnsnfs ~]# rpm -qa|grep mariadb mariadb-libs--.el7.centos.x86_64 [root@h ...

  7. Jedis和JAVA对象的序列化和反序列化的使用

    1. Jedis版本: jedis-2.6.2.jar 背景:现在系统提供portal接口服务,使用JDBC直接查询数据库,使用jedis提供的缓存功能,在JDBC前面加上Redis,先从Redis中 ...

  8. Netty原理剖析

    1. Netty简介 Netty是一个高性能.异步事件驱动的NIO框架,基于JAVA NIO提供的API实现.它提供了对TCP.UDP和文件传输的支持,作为一个异步NIO框架,Netty的所有IO操作 ...

  9. 在SSM框架中,multfile转file

    import org.apache.commons.fileupload.disk.DiskFileItem; import org.springframework.web.multipart.Mul ...

  10. TCGA系列--LncMAP

    LncMAP:http://www.bio-bigdata.com/LncMAP/index.jsp