首页 \ 问答 \ 当MainThread处于阻塞状态时ANR对话框如何显示(How ANR dialogs shows while MainThread is in Blocked state)

当MainThread处于阻塞状态时ANR对话框如何显示(How ANR dialogs shows while MainThread is in Blocked state)

我正在阅读ANR 。 大多数事情对我来说都有意义,但我不明白如果主线程被阻塞,操作系统如何在同一个进程中创建一个Dialog并将其显示在屏幕上。 从文档:

当下列情况之一发生时,您的应用将触发ANR:

1.当您的活动处于前台时,您的应用程序在5秒内未响应输入事件或BroadcastReceiver (例如按键或屏幕触摸事件)。

2.虽然您没有在前台进行任何活动,但您的BroadcastReceiver尚未在相当长的时间内完成执行。

即主线程与另一个线程处于死锁状态所以操作系统如何设置显示对话框。 因为我认为我们只能从主线程显示对话框。 请纠正我,如果我错了,让我知道ANR对话的过程。
任何解释将非常感激。 谢谢


I am reading ANR. Most of things make sense to me but i can not understand that if Main thread is blocked then How OS create a Dialog in same process and show it on screen . From the Documentation:

An ANR will be triggered for your app when one of the following conditions occur:

1. While your activity is in the foreground, your app has not responded to an input event or BroadcastReceiver (such as key press or screen touch events) within 5 seconds.

2. While you do not have an activity in the foreground, your BroadcastReceiver hasn't finished executing within a considerable amount of time.

i.e The main thread is in a deadlock with another thread So how the OS manage to show a dialog . Cause i think we can only show dialog from a main thread. Please correct me if i am wrong and let me know the process of ANR dialog.
Any explanation will be really appreciated. Thx


原文:https://stackoverflow.com/questions/49423123
更新时间:2023-09-19 12:09

最满意答案

课程的自定义字段被添加到Totara - Moodle的发行版。

它们与用户配置文件字段非常相似。

您需要从各个地方提取代码。

自定义字段的主要代码是

https://github.com/moodlehq/totara/tree/t2-release-2.5/totara/customfields

这里的数据定义 - 查找course_info_field和course_info_data

https://github.com/moodlehq/totara/blob/t2-release-2.5/totara/core/db/install.xml

另请查看course_info_field和course_info_data的源代码中的其他位置以查看它的集成位置。


Custom fields for courses were added to Totara - a distribution of Moodle.

They are very similar to the user profile fields.

You will need to extract the code from various places though.

The main code for the custom fields is in

https://github.com/moodlehq/totara/tree/t2-release-2.5/totara/customfields

The data definition in here - look for course_info_field and course_info_data

https://github.com/moodlehq/totara/blob/t2-release-2.5/totara/core/db/install.xml

Also look elsewhere in the source for course_info_field and course_info_data to see where it has been integrated.

相关问答

更多
  • 你的第二行
    应该是
    没有在col-12中的bootstrap中。 你也可以先在这里试试 bootstrap表。 Your second line
    should be
    there i ...
  • 是的,我相信enrol_plugin :: sync_user_enrolments()可以做到。 来自lib / enrollib.php : /** * Forces synchronisation of user enrolments. * * This is important especially for external enrol plugins, * this function is called for all enabled enrol plugins * right afte ...
  • 你没有正确地创建视图,这就是为什么你有错误,仔细按照说明,我做了,并且它在我身边工作得很好。 After many hours of wanting to pull my hair out, I figured it out. Something VERY helpful to know for troubleshooting is that within the function CurlHttpRequest (line 135), you can access any curl errors gene ...
  • 课程的自定义字段被添加到Totara - Moodle的发行版。 它们与用户配置文件字段非常相似。 您需要从各个地方提取代码。 自定义字段的主要代码是 https://github.com/moodlehq/totara/tree/t2-release-2.5/totara/customfields 这里的数据定义 - 查找course_info_field和course_info_data https://github.com/moodlehq/totara/blob/t2-release-2.5/tot ...
  • 如果您运行Ubuntu(通过标记判断),您需要将项目目录放在/var/www 。 Apache无法访问指定目录中的项目文件夹,除非您更改用户/组等。 你尝试过的是web文件夹的普通apache默认位置,但Ubuntu喜欢改变一些东西。 if youre running Ubuntu (judging by the tag), you need to put your project directory inside /var/www. Apache cant access project folders i ...
  • 您可以使用Moodle创建自定义页面,记得需要配置并设置页面: require('../../../config.php'); require_once($CFG->libdir.'/adminlib.php'); //page definition $PAGE->set_context(get_context_instance(CONTEXT_SYSTEM)); $PAGE->set_url('/theme/your_theme/admin/manage.php'); $PAGE->set_pagetyp ...
  • 您是否已按照FreeTDS用户指南中的说明构建了支持FreeTDS的PHP? Have you built PHP with support for FreeTDS as described in the FreeTDS User Guide?
  • 在您输出的页面中的某个位置,您需要添加如下调用: $PAGE->requires->js_call_amd('PLUGINTYPE_videojs/test', 'init); 从您的示例中不完全清楚您正在创建什么类型的插件,因此无论您创建哪种类型( https://docs.moodle.org/dev/Plugin_types ),都需要将其放在您网站的相应子目录中(例如/ mod / videojs,/ local / videojs等),然后添加某种PHP脚本作为插件的入口点,并从那里调用js_c ...
  • Moodledata应该位于文件夹结构中的public_html 之上 ,如果不是,则会抛出错误。 作为安装程序的一部分,您应该有机会手动输入路径。 上面的路径中有星号,这绝对不是好事。 你加了这些吗? 此外,Moodledata目录在共享服务器上应具有比777更多的限制性权限 。 Moodledata should be above public_html in the folder structure and will throw an error if not. You should have an ...
  • 最好将课程ID传递给您的信息页面。 在原始页面中显示链接: $url = new moodle_url('\local\yourplugin\information.php', array('id' => $course->id)); echo html_writer::link($url, get_string('informationlink', 'local_yourplugin')); 然后在您的information.php页面中: $courseid = required_param('id' ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。