首页 > 试题广场 >

下面代码放在主线程中运行会引发ANR错误的选项是?

[单选题]
下面代码放在主线程中运行会引发ANR错误的选项是?
  • Toast.makeText(getApplicationContext(),"hello world",Toast.LENGTH_LONG).show();
  • mHandler.postDelayed(new Runnable() {<br>@Override<br>public void run() {<br>Toast.makeText(getApplicationContext(),&quot;hello world&quot;,Toast.LENGTH_SHORT).show();<br>}<br>},5000);
  • LayoutInflater.from(context).inflate(R.layout.something_layout, null);
  • HttpURLConnection urlConn = (HttpURLConnection) new URL(&quot;https://www. iqiyi.com&quot;).openConnection();
anr表示程序没有响应异常,主线程不能联网请求
发表于 2018-05-06 11:14:39 回复(0)