java.lang.ClassCastException: android.view.ContextThemeWrapper cannot be cast to android.app.Activity

Dialog中的context,在强制装换Activity出现。

将(Activity) mContext,变成:scanForActivity(mContext)

private static Activity scanForActivity(Context cont) {    if (cont == null)        return null;    else if (cont instanceof Activity)        return (Activity)cont;    else if (cont instanceof ContextWrapper)        return scanForActivity(((ContextWrapper)cont).getBaseContext());    return null;}


更多相关文章

  1. android 导入第三方库出现java.lang.NoClassDefFoundError
  2. android 修改系统显示u盘的名称
  3. android scrollview嵌套listview出现高度显示不全解决方案
  4. 更新android sdk出现 A folder failed to be renamed or moved
  5. Android(安卓)自定义Dialog时出现成员变量为null的问题
  6. Android(安卓)原生系统给电信发短信出现乱码或者收不到的原因
  7. Android源码下载出现的问题
  8. Android(安卓)Studio启动时出现unable to access android sdk ad
  9. 打开Android开发软件eclipse时出现parseSdkContent failed

随机推荐

  1. Android多线程AsyncTask详解
  2. android studio 模拟器闪退问题
  3. Android上替代SQLite的选择:Realm
  4. 只会写xml和Activity,做android真的不行!
  5. Android(安卓)TabLayout添加自定义分割线
  6. Android之Android的数据存储--SD卡
  7. [006] 百度地图移动版API终于发布了(Andr
  8. Android(安卓)SimpleAdapter显示ListView
  9. 五年之内,Android 或将被取代?
  10. android中检测网络连接状态简单总结