my graphical layout doesn't appear on my eclipse window at same time main.xml can visible and editable also,what happening on XML file.
i tried to close xml and opened again ,but still it continues..any permanent solution on this.
this happened on eclipse &MotoDev also
Sounds like XML files are being opened by an editor other than the default Android editor. This can be a problem if you are using other plugins that handle XML files.
Close all open windows
Right click your layout.xml and choose "Open With"
Choose "Android Common XML Editor"
If you have imported the project. then make it sure imported project should be in your selected workspace.
or
If you have imported some project from another platform i.e project is made in 2.2 and you have only 4.0, then it will not show you layouts, then you have to download 2.2 sdk for it
Related
I have this huge project to work on, but I don't know where certain XML files or activities are located.
I was wondering is it possible to find the path of a file using the layout inspector tool of the android studio because as it gives the live preview of the activity we are in
Yes, you can.
Right-click on a particular layout file in Android Studio
and popup come tap on Find Usages.
I was previously working on a 1 month project using Android Studio. My xml layout was all well and good until I opened it up today and had the following as my xml code:
As you can see the preview is showing the correct data, but the code is not.
What happened, how can I retrieve my original code?
Some of the files were not backed up on a VCS.
You can check the android studio local history if your files were not backed up:
Right click on your app folder - select "Local History" and "show history" to see your latest file that got changed
I can't open app folder as you see on the screenshot.
Can any one help me to solve this problem?
I use android studio.
It looks like you may have imported something incorrectly (or at least, Android Studio didn't take it correctly).
You can try changing the view of the project by clicking on "Android" above your files:
Then choose "Project," which should bring up a different view.
If "app" is still empty, then something is wrong with the files that you imported.
I've googled for the answer and read many forums and stackoverflow threads but I still can't get it to work.
I just started trying to develop my first Android app, and after following the instructions listed on the website, when I started the project, it opened with two tabs, one showing a java file, and the other showing an xml file. The tab with the xml file also had this simulation of an android phone on it where I could play around with the GUI.
When I stopped working on it, I closed all the tabs and closed eclipse, but now I want to work on it again and I don't know how to get it back to the setup showing the java and the xml file with the little simulation. I don't even know where the activity_main.xml is located.
I don't want to create a brand new project.
I tried importing a project, but the finish button is always grayed out or it wont let me import because it says that a project already exists in the workspace, or after I click on the folder containing all the bin, res, src, etc. files, and I click OK to import it, nothing happens.
Is it possible to just click on a single file, like the .sln file in visual studio, that will automatically launch eclipse with your project ready to go?
The activity_main.xml is located in your_project/res/layout.
Just open Eclipse and navigate to this directory in Package Explorer window:
When you double click the activity_main.xml you should see the XML and Graphical Layout tabs at the bottom.
Here is a description of android project structure:
http://developer.android.com/tools/projects/index.html#ApplicationModules
Make sure you uncheck the copy attribute when you import the project, this solve the project is already exit problem, and you can try both Existing Project Into Workspace and Existing Android Code Into Workspace.
The layout file lay in project_name/res/layout.
Source file lay in project_name/src.
You can double click to open your files, and your files remain open the next time you open eclipse, only if you don't close them when you exit the eclipse.
There are a few ways to reopen your project again:
Try to open the project explorer:
-> Window -> View -> Project Explorer -> Hit refresh
Open your .project file (in your workspace) an edit the name in the xml name tag and try do import again.
Please make a backup before.
this is driving me a bit crazy, but the way android lays things out, is you have different directories with the same xml name.
so, for example, you might have:
res/layout/main.xml, and
res/layout-land/main.xml
When you're in landscape mode, it will know to use the one in the layout-land directory.
The really irritating thing is that when I'm in Eclipse, and I have res/layout/main.xml file open, and if in the project explorer I click to open the one in layout-land/main.xml, it just leaves the one you already have open (res/layout/main.xml) open. This is super annoying. You can get around it by simply closing the one that's open, and then when you click to open the one in layout-land it will open the proper one, but not as long as you already have a file with that name (not same directory) open.
Is there any way to fix this other than using a different editor or 'living with it'?
When I do as you describe, Eclipse opens the new layout and automatically closes the other one. It appears as if the same file stayed open; however, the contents change, and if you hover over the editor tab, you can see which folder the file comes from. The result is that you can only have one version at a time of a particular layout open in the Android Layout Editor. This is probably a necessary restriction due to the internals of the Android Layout Editor.
If you want to edit both files concurrently, you can open one or both with the XML editor (right-click > Open With > XML Editor).
This is fixed in the latest Indigo release of Eclipse (Service Release 1), however it doesn't always open the files in the layout-land folder with the Android Layout editor. To force this you can right-click on the file and select Open With... > Android Layout Editor.