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.
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.
When i open android studio it shows me blank screen like i don't have any projects with a yellow message at the top corner that says "can't load setting from file workspace.xml..."
After i tried to delete the workspace.xml file as suggested here and open android studio again the message didn't appear but it was still without any projects. Yesterday everything worked fine and i can still see my project data on the windows explorer. Can someone please tell me how to fix this issue.
go to your user folder
[SYSDRIVE]:\Users[your username] (ex. C:\Users\aman)
In this folder there should be a folder called .AndroidStudioBeta or .AndroidStudio (notice the period at the start - so on some OSes it would be hidden).
Delete this folder (or better yet, move it to a backup location - so you can return it if something goes wrong).
this will solve your problem.
I have just made an application that uses a SQLite database, and I finally managed to export the database file onto the computer without having to root the Android device. The method I am using is mostly from code I found on various Stack Overflow question/answers. I am basically saving the database file to the public Download folder.
When I look on the Android device using a file explorer, I can see the correct SQLite file in the correct folder (Download folder). However, when I open up the same folder in Windows Explorer from my PC, I can not see the file in the exact same folder.
Now here is the strangest part: When I copy or move the file (using the Android device), even if I am copying and/or moving the file TO THE EXACT SAME SPOT, as soon as I have finished doing this the file instantly becomes visible in Windows Explorer.
I do not want the user to have to do this manually every time, so does anyone know of any way to make sure that the file will be visible right away? Thank you in advance!
Things I have tried so far:
Show hidden files and folders in Windows Explorer
Programmatically moving the file to a new folder within the application itself (the move to the new folder works, but the file still remains invisible in Windows Explorer until manually moving/copying the file again)
Searched StackOverflow for similar issues and have been unsuccessful.
And if anyone wants to see some of my code, let me know and I will post it, but I am thinking that this is less to do with my code and more to do with Android/Windows interaction. And this is where I got my move folder function from: stackoverflow.com/questions/4178168/how-to-programmatically-move-copy-and-delete-files-and-directories-on-sd
Thank you!
I had a similar issue and it was not visible in Windows because I hadn't given it a file extension.
Give it a file extension if you haven't already.
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.
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