首页 \ 问答 \ 超级骨干(Super in Backbone)

超级骨干(Super in Backbone)

当我覆盖Backbone.Modelclone()方法时,有没有办法从我的植入中调用这个覆盖方法? 这样的东西

var MyModel = Backbone.Model.extend({
    clone: function(){
        super.clone();//calling the original clone method
    }
})

When I override the clone() method of a Backbone.Model, is there a way to call this overriden method from my implantation? Something like this:

var MyModel = Backbone.Model.extend({
    clone: function(){
        super.clone();//calling the original clone method
    }
})

原文:https://stackoverflow.com/questions/8596861
更新时间:2023-07-16 21:07

最满意答案

尝试调用record.start()而不是.run()。

Java API文档

start()使该线程开始执行; Java虚拟机会调用此线程的运行方法。

你也可能想看看AsyncTask


Try calling record.start() instead of .run().

From the Java API Docs:

start() Causes this thread to begin execution; the Java Virtual Machine calls the run method of this thread.

You also may want to look into AsyncTask.

相关问答

更多
  • 您基本上只需添加一个并发送Message或Runnable 。 private final Handler mUiThreadHandler = new Handler(Looper.getMainLooper()); void fromAnyThread() { final String importantDataFromBackGroundThread = "!!!"; mUiThreadHandler.post(new Runnable() { @Override ...
  • 尝试调用record.start()而不是.run()。 从Java API文档 : start()使该线程开始执行; Java虚拟机会调用此线程的运行方法。 你也可能想看看AsyncTask 。 Try calling record.start() instead of .run(). From the Java API Docs: start() Causes this thread to begin execution; the Java Virtual Machine calls the run m ...
  • 如果您的活动位于相同的软件包/应用程序中,则可以将该线程的引用放入Application对象中,以便可以从您的所有活动中访问它。 您需要创建一个自定义应用程序子类并在清单中引用它。 如果您正在查看来自不同包的活动,我可以使用广播接收器模型或绑定服务。 If your activities are in the same package/app, you could put a reference to the thread in the Application object so that it can b ...
  • 避免你所描述的情况的唯一可靠方法是将结果保存到某种存储中。 您可以启动服务来执行长时间运行的任务,并将结果写入数据库,并在完成时发送本地广播。 如果活动恰好位于前台,它将接收广播并更新其状态以了解该过程已完成,并可从您使用的任何持久存储机制中删除有关该任务的信息。 如果活动在后台,则服务将完成,发送广播并保留结果。 下次活动到达前台时,它应检查此持久存储并查看是否存在未解析的任务状态,并更新其状态以进行匹配。 因此,一个示例纲要可能是(让我们使用“上传照片”作为任务): 用户单击按钮以开始上载图像 Acti ...
  • 在调用list.add()之前,请确保已实例化列表对象: list = new ArrayList(); Make sure you have instantiated your list object before you call list.add(): list = new ArrayList();
  • 上面的代码没有任何问题会导致ANR ,因此很可能发生以下情况之一: 您正在尝试从doInBackground修改用户界面(UI) doInBackground发生异常 如果在收到错误时发布LogCat输出或堆栈跟踪,则更容易识别。 There aren't any problems with the code above that would cause an ANR, so most likely one of the following is happening: You are trying to m ...
  • AsyncTask自动为你创建一个新的线程,所以你在doInBackground()做的所有事情都在另一个线程上。 你在做什么是这样的: AsyncTask创建一个新的线程并运行doInBackground() 。 从AsyncTask-Thread创建一个新的Thread( t )。 doInBackground()完成,因为它所做的就是创建Thread t并跳转到onPostExecute() 。 线程t仍然会在后台运行(但是,您不要在t上调用start() ,这意味着它不会启动)。 相反,你希望你的d ...
  • IntentService IntentService绝对是一种有效的方法。 您可以使用广播将结果返回到应用程序的另一个组件,无论是活动还是其他服务,例如: 启动IntentService - 如果需要某些参数,请将它们放在服务意图的Extras中。 您的IntentService在后台线程上运行,直到计算完成。 完成后,发送一个广播,计算结果放在意图附加内容中。 在您的活动中,注册一个BroadcastReceiver ,它将监听您的计算结果广播。 在您的Activity中获取广播后,从intent ex ...
  • 当设备空闲时,CPU将停止并且所有正在运行的线程都会暂停(C ++或Java)。 如果它因任何原因被唤醒,你的C ++线程将再次开始工作,因此随机行为:其他应用程序或服务可能会不时唤醒设备。 添加部分唤醒锁可以在您的情况下工作,但这将防止CPU空闲,这将导致一些电池耗尽。 如果你不在乎你可以使用这种方法,如果电池就绪是一个问题, 你可以使用Java报警API定期唤醒设备。 然后java API可以通过JNI调用C ++代码 。 重复警报的Android文档: https : //developer.andr ...
  • doinBackground是非UI线程,所以永远不要更新此方法中的任何UI(View)... 并使用OnPostExecute or OnProgressUpdate for update UI @Override protected Void doInBackground(Void... params) { //here just background task , //its non UI Thread so dont set ant view her ...

相关文章

更多

最新问答

更多
  • 获取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的基本操作命令。。。