Android ContextThemeWrapper cannot be cast to android.app.Activity
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;
}
相關文章
- android.app.Application cannot be cast to 新建的ApplicationAndroidAPPAST
- cannot be cast to java.lang.ComparableASTJava
- java.lang.ClassCastException: android.widget.FrameLayout$LayoutParams cannot be cast to android.widgJavaASTExceptionAndroid
- 解決String cannot be cast to java.util.List報錯ASTJava
- SQL中欄位比較型別不匹配錯誤:‘cannot be cast to’SQL型別AST
- java.lang.ClassCastException: com.alibaba.fastjson.JSONObject cannot be cast to com.JavaASTExceptionJSONObject
- JAVA int 強制型別轉換錯誤提示(Cannot cast from Object to int)Java型別ASTObject
- com.alibaba.fastjson.JSONObject cannot be cast to XXX異常解決ASTJSONObject
- C++之static_cast,dynamic_cast,const_castC++AST
- 7.41 CASTAST
- java.lang.String cannot be cast to com.alibaba.fastjson.JSONObject解決辦法JavaASTJSONObject
- C++強制型別轉換:static_cast、dynamic_cast、const_cast、reinterpret_castC++型別AST
- teradata CASTAST
- oracle cast 用法OracleAST
- dynamic_castAST
- static_cast與dynamic_cast到底是什麼?AST
- reinterpret_cast 和 static_cast 的區別AST
- Cause: java.lang.ClassCastException: java.lang.String cannot be cast to org.apache.ibatis.mapping.MappedStatementJavaASTExceptionApacheBATAPP
- C++中static_cast, dynamic_cast, const_cast用法/使用情況及區別解析C++AST
- android studio 中 Cannot resolve symbol RAndroidSymbol
- Laravel 5 Eloquent cast arrayLaravelAST
- Oracle的Cast的用法OracleAST
- oracle function函式castOracleFunction函式AST
- 型別轉換(cast)型別AST
- android studio Cannot reload AVD list問題Android
- C++中dynamic_cast與static_cast淺析與例項演示C++AST
- static_cast和dynamic_cast的區別,看完這篇你就懂了!AST
- SQL中的cast()函式SQLAST函式
- const_cast的用法AST
- Oracle CAST函式不生效OracleAST函式
- Golang 型別轉換庫 castGolang型別AST
- substr,substrb,cast的使用、比較AST
- oracle 特殊SQL(TABLE( CAST( MULTISET()[zt]OracleSQLAST
- cast函式的用法案例AST函式
- (轉)Go 每日一庫之 castGoAST
- Oracle中CAST函式使用簡介OracleAST函式
- java基礎:型別轉換castJava型別AST
- C++四種cast操作符C++AST