Is there any way to refactor the name of a class file as well as all the references to that name in the Android project?
For example, if I Refactor > Rename the file CustomerListFragment.java , the following reference in Android resource files still needs to be changed manually.
<fragment android:name="my.package.CustomerListFragment"
android:id="@+id/item_list"
android:layout_width="400dp"
android:layout_height="match_parent"
/>
I think Visual Studio does this kind of refactoring automatically, is there any equivalent in Eclipse(Android)?
Yes and no, it's actually listed on their roadmap as: Better refactoring support
Believe it or not, the refactoring/renaming support has actually gotten better over the last couple of weeks. Until very recently, it was still making mistakes when replacing class names and package names in the Manifest file (whenever some Activity file name was being refactored/renamed). But lately, I haven't been getting these errors, and I'm very happy that this isn't a manual step I have to do anymore.
You can also check out their bug tracker at: http://b.android.com and star the issue if you really want to get notified when this exact test case gets taken care of.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With