文章分类 -  异常

摘要:关于继承IntentService,构造函数需要注意一个地方,Eclipse默认生成的构造函数是 public MyIntentService(String name) { super(name); }而官方文档的示例中是没有参数的构造方法,使用Eclipse这个默认构造函数的话会报一个运行时错误: java.lang.InstantiationException,在Google Groups里找到了解决办法,继承IntentService的类必须有一个public的无参的构造函数,将上面Eclipse自动生成的构造函数改为下面这样的就... 阅读全文
posted @ 2011-10-12 09:49 SaiWu 阅读(3266) 评论(0) 推荐(0)
摘要:ArrayAdapter.add();调用这个方法add("为Adapter增加内容")但是出现Caused by: java.lang.UnsupportedOperationException百思不得其解于是在网上找到了原因当您创建您的ArrayAdapter你有没有给它分配一个resizeable名单,因此,当你添加(),它不能递增它的大小,并抛出一个UnsupportedOperationException。尝试这样的事情:List<CharSequence> planets = new ArrayList<CharSequence>(); 阅读全文
posted @ 2011-08-18 14:07 SaiWu 阅读(1795) 评论(0) 推荐(0)
摘要:View Code protected Dialog onCreateDialog(int id) {switch(id){ case NEWMESSAGEDIALOG: LayoutInflater lf=LayoutInflater.from(this); final View alertView=lf.inflate(R.layout.newmessagedialog, null); final ImageButton newMessageIB=(ImageButton) alertView.findViewById(R.id.newmessageSearch); final EditT 阅读全文
posted @ 2011-08-18 14:06 SaiWu 阅读(782) 评论(0) 推荐(0)
摘要:因为未完成加载就播放了,应该调用sp.setOnLoadCompleteListener(new OnLoadCompleteListener(){ @Override public void onLoadComplete(SoundPool arg0, int arg1, int arg2) { sp.play(spload, 1, 1, 1, 1, 1); }});监听加载完成后调用播放 阅读全文
posted @ 2011-08-18 14:04 SaiWu 阅读(1419) 评论(0) 推荐(0)
摘要:INFO/ActivityManager(61): Starting: Intent { cmpXXXXXXXX是因为不同的activity调用xml混乱所致,估计是主要是非启动activity也调用了相同的main.xml 阅读全文
posted @ 2011-08-18 14:04 SaiWu 阅读(538) 评论(0) 推荐(0)