I'm trying to learn how to program android applications, so I downloaded the ADT bundle that google supplied, and I tried following the tutorial that allowed me to create a simple application. However, during the procedures, there are several instructions telling me to open up the fragment_main.xml file, but my layout/res/ directory did not have this file, only the activity_main.xml file. Furthermore, when creating new Android activities, there was never an option to name my fragment layout, indicating that eclipse just doesn't create it for some reason. I didn't think this would be an issue at first (I just edited activity_main instead), until I realized that the tutorial wanted us to use the some information from the fragment class or xml file.
Does anyone know why my Eclipse IDE is not creating a fragment_main.xml? I will try to supply more details if necessary.
While creating the new Android Project in one of the panels select "Blank activity with Fragment" instead of default selection "Blank Activity". The Android Developer tutorial does not say anything about it. Doing so will create the file fragment_main.xml in res/layout/ which is needed to continue subsequent steps.
Based on the versions you indicated in the comment response, I think updating to the later versions (22.6+) would help, as discussed in https://code.google.com/p/android/issues/detail?id=67421
Try creating a new project with "Blank Activity with Fragment". I hope this is helpful.
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