IS" ANR"异常或错误还是什么? [英] Is "ANR" exception or error or what?

查看:185
本文介绍了IS" ANR"异常或错误还是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

时的ANR例外,错误还是什么?我们实际上可以赶上它在一个尝试{}赶上(){} 结构?

Is the ANR an exception, an error or what? Can we actually catch it in a try{} catch(){} structure?

推荐答案

ANR (应用程序无响应)不完全是一个error.It显示,当你的应用程序非常缓慢,需要大量的来不及反应使用户wait.The用户如果您的应用程序让他等待了很长的时间,以便在Android框架为用户提供了关闭您的应用程序了一个选项不是AP preciate。 <一href="http://developer.android.com/guide/practices/design/responsiveness.html">http://developer.android.com/guide/practices/design/responsiveness.html

ANR (Application Not Responding) is not exactly an error.It is shown when your application is very sluggish and takes a lot of time to respond making the user wait.The user won't appreciate if your application makes him wait for a long time so the android framework gives the user an option of closing your applicaiton. http://developer.android.com/guide/practices/design/responsiveness.html

这会发生,当你正在做的主线程上长时间运行的业务和系统无法在此期间,因为主线程处理用户的交互是blocked.The解决办法是做繁重的业务工作线程,并保持主线程自由。

This occurs when you are doing long running operations on the main thread and the system can't process user interactions during this period since the main thread is blocked.The solution is to do the heavy operations in a worker thread and keep the main thread free.

这篇关于IS&QUOT; ANR&QUOT;异常或错误还是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆