当前位置:编程学习 > wap >>

imageView = new ImageView(this);无法执行

--------------------编程问答-------------------- ImageView的构造函数式这样的 
ImageView(Context context)
你应该imageView = new ImageView(getApplicationContext()); --------------------编程问答--------------------
引用 1 楼 detective2005 的回复:
ImageView的构造函数式这样的 
ImageView(Context context)
你应该imageView = new ImageView(getApplicationContext());
.
this不行吗?

楼主你打断点debug下,看看到底哪行出了错 --------------------编程问答-------------------- imageView=new ImageView(MainActivity.this);这样可以的
imageView=new ImageView(this);
你那样操作的话,是取到子线程的,不是主线程 --------------------编程问答-------------------- 我是LZ。问题是解决了,确实是引用context引用错了.
但是有点我不明白,子线程不是指的run里面的代码? 那我这段代码,哪些是属于子线程的? --------------------编程问答-------------------- handler
补充:移动开发 ,  Android
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,