Chinaunix首页 | 论坛 | 博客
  • 博客访问: 203538
  • 博文数量: 20
  • 博客积分: 1380
  • 博客等级: 中尉
  • 技术积分: 280
  • 用 户 组: 普通用户
  • 注册时间: 2007-03-28 14:52
文章分类
文章存档

2017年(2)

2014年(3)

2013年(1)

2009年(1)

2008年(1)

2007年(12)

我的朋友

分类: Android平台

2014-05-20 15:50:26

    今天在改上一篇中的bug(android.support.v4.app.Fragment$InstantiationException)时又发现了一个问题,经过实验得出结果.
   Fragment中获取Activity的Context时只需要this.getActivity()即可.
    而不是许多人说的this.getActivity().getApplicationContext(),如果用后者传入AlterDialog肯定会报错(android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application).
   因为只有activity才可以再开新的窗口.
阅读(21096) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~