1

I am doing the tutorial for making your first android app and it is saying I need to open the activity_main.xml file in the layout folder.

However, when I open the the layout folder it doesn't have anything in it. There are no files at all.

This is the first bit of programming I am doing. please give me an answer.

Dexters
  • 2,419
  • 6
  • 37
  • 57
user3424411
  • 13
  • 1
  • 6
  • Try to close eclipse and restart or try to clean the project by going to Project and clean.. See if that helps. – mike20132013 Mar 15 '14 at 22:50
  • I tried those as you suggested and so nada. I still have nothing in the resource folder that was supposed to be added automatically. Earlier I also deleted the project and restarted it. I used the settings the tutorial gave but maybe it's outdated? Is there a setting in the project setup that will leave it empty? – user3424411 Mar 15 '14 at 22:59
  • Try deleting the bin and gen folder from your workspace from your project files and then close eclipse and restart and clean the project again. – mike20132013 Mar 15 '14 at 23:01
  • If that doesn't work, there's some problem with the xml – mike20132013 Mar 15 '14 at 23:02
  • Could this be because the package is named com.example.myfirstapp I know I can't publish that to the google play network but I thought I could at least play with the emulator this way. – user3424411 Mar 16 '14 at 00:59
  • Can you post your activity_main.xml and also your MainActivity.java? Maybe then we can take a look at the code. Also, I am sure that you are not able to see the R.java. Just post your code and we can figure it out – mike20132013 Mar 16 '14 at 01:01
  • Did you do a check mark on "create activity" when creating the project ?? – mike20132013 Mar 16 '14 at 01:06

4 Answers4

2

Your layout xml files are located in src/main/res/layout/. If they do not show up, you can check the file directory where the project is saved on your computer. If they still do not show up I suggest restarting eclipse and then rebuild/clean. If the problem persists you may need to create a new project

Eamon Scullion
  • 1,354
  • 7
  • 16
  • I tried doing as you said here but nothing still shows up. I did also delete it and create a new project but it still comes up empty. Maybe I need to try and mess a little with the settings in the poject setup? Or should those folders always be there? – user3424411 Mar 15 '14 at 23:24
0

If your files are in the disk folder, but aren't showing in Eclipse, then you'll want to refresh the project contents. You can do that by clicking on your project in either the Project or Package window and pressing F5 (or by right-clicking and selecting the Refresh item.)

scottt
  • 8,301
  • 1
  • 31
  • 41
  • Unfortunately this did not work either. Any other suggestions? – user3424411 Mar 15 '14 at 23:29
  • In that case, it sounds like the file really doesn't exist and needs to be added. You can add a file by right-clicking on the layout folder, then 'New', then 'File'. Enter the file name 'activity_main.xml', click 'Finish', and cut-and-paste the contents into the empty editor window that is created. – scottt Mar 15 '14 at 23:41
  • So far that appears to have helped! Thank you very much. Like I said I am a beginner here so I wasn't sure if I could even just do that. – user3424411 Mar 16 '14 at 01:29
0

It is possible that you didn't create the activity when you created the project and that's the reason you don't see the layout in your When you created the project:

Please follow these steps:

1) Enter your application name in the wizard.

2) Enter Project Name

3) Enter package name.

4) Check mark on 3 items when you clck next "Create custom launcher icon", "Create activity", "Create project in workspace"

5) Again when you click next, Check mark on Create Activity and do next.

6) Make sure that the next screen has all the fields populated. Like (Activity name, Layout name)

7) After all that, click finish.

You must have missed all these steps while creating your project. Try this.

mike20132013
  • 5,357
  • 3
  • 31
  • 41
0

Make sure that the the Activity Name and Layout name are not completely different

Knuros
  • 1