使用ClipboardManager碰到Can't create handler inside thread that has not called Looper.prepare()
直接放上我的代码。希望能给碰到相同问题的朋友提供帮助
Runnable runnable = new Runnable() {
public void run() {
ClipboardManager clipboard = (ClipboardManager)GameUtil.getIntance().getContext().getSystemService(Context.CLIPBOARD_SERVICE);
clipboard.setText(content);
}
};
GameUtil.getIntance().getGameActiviti().runOnUiThread(runnable);
使用ClipboardManager碰到Can't create handler inside thread that has not called Looper.prepare()的更多相关文章
- [Android]Can't create handler inside thread that has not called Looper.prepare()
更新是由于在新的线程来打开UI只有一个错误.子线程更新主线程UI需要使用Handler. 还有比如今天出现以下错误.码,如以下: send.setOnClickListener(new OnClick ...
- Android进阶(十六)子线程调用Toast报Can't create handler inside thread that has not called Looper.prepare() 错误
原子线程调用Toast报Can't create handler inside thread that has not called Looper.prepare() 错误 今天用子线程调Toast报 ...
- 在子线程中new Handler报错--Can't create handler inside thread that has not called Looper.prepare()
在子线程中new一个Handler为什么会报以下错误? java.lang.RuntimeException: Can't create handler inside thread that has ...
- Android 线程更新UI报错 : Can't create handler inside thread that has not called Looper.prepare()
MainActivity中有一个按钮,绑定了save方法 public void save(View view) { String title = titleText.getText().toStri ...
- 关于子线程使用Toast报错Can't create handler inside thread that has not called Looper.prepare()的解决办法
形同如下代码,在Thread中调用Toast显示错误信息: new Thread(new Runnable(){ @Override public void run() { try{ weatherD ...
- Can’t create handler inside thread that has not called Looper.prepare()
1)在Android 2.3以前,为防止ANR(Application Not Responding),Google是不赞成将网络连接等一系列耗时操作直接放到应用主线程进行的,推荐将这类操作放在子线程 ...
- Android-java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
章出自:luchg技术交流 http://www.luchg.com 版权所有.本站文章除注明出处外,皆为作者原创文章,可自由引用,但请注明来源,谢谢. Android-java.lang.Runti ...
- Android handler 报错处理Can't create handler inside thread that has not called Looper.prepare()
问题: 写了一个sdk给其他人用,提供一个回调函数,函数使用了handler处理消息 // handler监听网络请求,完成后操作回调函数 final Handler trigerGfHandler ...
- Android进阶(八)Can't create handler inside thread that has not called Looper.prepare()
Error:Can't create handler inside thread that has not called Looper.prepare() 原代码: //利用Handler消息传递机制 ...
随机推荐
- git hub的GUI软件配置与使用
1. 安装两个软件 1. git的命令行程序--git for windows:http://git-scm.com/download/win 2. git的GUI程序--tortoisegit:ht ...
- 使用NSHashTable存储引用对象
NSHashTable 我们使用集合(NSArray,NSMutableArray,NSDictionary,NSMutableDictionary,NSSet,NSMutableSet)存储对象时会 ...
- 仿LOL项目开发第三天
仿LOL项目开发第二天 by草帽 昨个我们已经实现了下载功能,但是发现没有,下载的包是压缩的,没有解压开,那么Unity是识别不了的. 所以今个我们来讲讲如何实现解压文件. 还记得吗,我们在Downl ...
- 为jquery ajax请求增加正在运行提示
在jquery源码中增加showMask()方法调用: if ( xhrSupported ) { jQuery.ajaxTransport(function( options ) { // Cros ...
- Mysql客户端中文乱码问题解决
另一篇一样的: http://www.cnblogs.com/charlesblc/p/5973488.html 在Linux机器上使用Mysql客户端访问获取中文有时候是乱码,如下: mysql&g ...
- OpenMP 线程同步之临界区
多核/多线程编程中肯定会用到同步互斥操作.除了互斥变量以为,就是临界区. 临界区是指在用一时刻只允许一个线程执行的一段用{...},包围的代码段. 在OpenMP中临界区声明方法如下: #pragma ...
- WinForm特效:同时让两个窗体有激活效果
windows api,一个窗体激活的时候给另外一个发消息 using System; using System.Windows.Forms; using System.Runtime.Interop ...
- Java 中 方法名或类名 变更 同时 更新 所有引用的 类名或方法名 的解决方案
选中 类名,或属性名 Ctrl + 1 然后选择 理新当前文件,还是更新整个工作空间,然后修改对应的类名或方法名 回车即可. 如果.有SVN 版本在控制着,则 会提示,然后把对应的文件 锁定 再 ...
- Android小技术知识(多用于面试)
Android Dev Doc Android 开发 多使用内部类 使用方便且效率高 UI方面的知识 一.在编写layout的xml文件时,一定要仔细!如果在报错的时候,如何解决? 解决:将xml仔细 ...
- [javase学习笔记]-8.1 statickeyword之特点
这一节我们来学习java语言中一个新的keyword就是statickeyword. 当然对于每个keyword,我们都要明白的是它有什么作用,怎么用.我们先来看一个样例: class Person ...