Android studio how to automatically convert a field to a local variable

Sometimes you can run the warning “Field can be converted to a local variable” in Android Studio (AS). Is there a way to do this conversion automatically using AS?

+4
source share
1 answer

Android Studio added this option in the meantime (I have version 1.5.1). When you run the Analyze / Inspect Code, you have “The field may be local” in the “Class structure” section, and when you click on this problem in the left pane, in the right pane you are prompted with the “Convert to local” link, which does this automatically.

+4
source

All Articles