Can Android Studio Automatically Extract References From a Layout XML file into the Activity java file?
android, android-studio, eclipse, java, xml
Solution
There is plugin to Android Studio called ButterKnifeZelezny, which provides feature you're requesting but only if you're using ButterKnife. You can select what you want to import and so on.
Problem
Back in the day MotoDev Studio (Eclipse based, put out by Motorolla) had a feature to extract references from your XML into your code. Standard Eclipse with the ADT didn't have this feature but was wondering if it's possible in Android Studio. So for example given XML: ``` <Button android:id="@+id/my_button"> ``` It would generate in your activity's class: ``` private Button mMyButton; @Override protected void onCreate(Bundle savedInstanceState) { ... mMyButton = (Button) findViewById(R.id.my_button); } ```