2017-10-13 61 views
1

以前我在使用ShadowAlertDialog.getLatestAlertDialog()來使用Robolectric測試AlertDialog。不過,我已經更新了我的用戶界面,現在我正在使用V7支持庫。所以,它給了我不兼容的類型錯誤。Android中的Robolectic與V7支持庫問題

Error:(82, 50) error: incompatible types 
required: android.support.v7.app.AlertDialog 
found: android.app.AlertDialog 

有沒有解決此問題的解決方案?

回答

0

很簡單!更改爲:

AlertDialog latestAlert = (AlertDialog) ShadowDialog.getLatestDialog()