I don\'t know what the exact name is for s feature like this, but I will just describe it.
I am using android studio and I added some java classes from a different proje
For Windows/Linux, you can go to File -> Settings -> Editor -> General -> Auto Import -> Java and make the following changes:
change "Insert imports on paste" dropdown value to "All"
check "Add unambiguous imports on the fly" option
On a Mac, do the same thing in Android Studio -> Preferences