Eclipse: autocompletion and support lib(?)



I have medium-sized problem with this chapter: my autocompletion doesn’t work properly, for example when I type:

Fragment fragment = fm then after I press dot I see:

I googled a bit, and it seems like this problem arises when there is no source for appropriate functions. Therefore, how do I add it?


Check your imports, I used autoImport at one point and it appeared that it picked up the native android fragment manager not the support library. I had to go back and fix the include, and then everything cleared out.


Later versions of the SDK also have the option to download the source. That should also add the information you’re looking for - it may require an Eclipse restart.


The proliferation of Android OS versions has a whole chapter devoted to it in the book, but the very next chapter on Fragments doesn’t mention that all of the automatically included import statements are going to be incorrect - instead of:


we will get import statements that do not include the support library. The only way to get the right files w/o actually knowing what to import is to delete, say, “import” and then eclipse -> organize imports, and then select from the two choices presented to us. Repeat.