android - Android Studio 中的 "Safe Delete"是什么?

标签 android android-studio

当我想删除一个类或布局时,我会收到一个弹出窗口,询问我是否要“安全删除”它。

我想知道所有的选项到底是什么,但我找不到任何好的答案。

那么这三个选项到底是什么意思呢?

enter image description here

最佳答案

通过安全删除,Android Studio 将搜索您的“WebViewA”是否在另一个文件中使用,因此如果您删除它不会导致任何错误。

例如,如果您在 MyActivity 类中使​​用 WebViewA 类,然后在没有安全删除的情况下删除 WebViewA 类,MyActivity 类中将出现新错误。

这是安全删除的例子:

我尝试删除 BluetoothUtility 类并使用安全删除,然后 Android studio 检测到 BluetoothUtility 有 2 种用法

enter image description here

选择 View Usages 后,我可以发现我在 MyActivity 类中使​​用了 BluetoothUtility。 我也可以从中进行重构。

enter image description here

希望我的解释足够清楚! :)

关于android - Android Studio 中的 "Safe Delete"是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26274473/

相关文章:

android - 如何在 androidTest 范围内使用 kapt

android - 将android studio项目迁移到eclipse

Android Studio 2.0,开发的app可调试但不显示在app drawer

android - 在 Android Studio 中连接到 Firebase 的 Gradle 的当前版本是什么?

android - 在 activity_main.xml 中使用来自 MainActivity.java 的字符串

c# - 如何设置背景图片 Xamarin Android

android - Instagram 类应用 Realm 与 CursorLoader

android - 使用 Android Studio 的 FCM 通知

android - 如何在没有gps的情况下在android中获取当前的纬度和经度

android - 通过 Intent 使用基于 Tesseract 的 OCR