I am trying to inspect layout for a fragment, and I want to open correct xml file which does contain the selected view.
When I google about it, I found that Android Studio allow us to do that if we are running our application on device > 29.
While I was trying it, I found that for some projects Android Studio does show the correct xml file in which the view is written. But, for other projects it does not show that information.
To clear it more, here are 2 screenshots of the different projects.
Here, Android studio only shows the #id/buttonAddNew for the button. But it does not show the xml file.
But, here Android Studio shows the #id/imageViewNotificationBell along with the home_fragment.xml file name and line number.
So, how can I solve this issue?
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'm modifying the Firefox Android App. I'm trying to change the search suggestions feature from Google to another search engine. To do this I have to change 2 files
The first file I change is:
fenix/app/build/intermediates/merged_assets/debug/out/search/list.json
The second file that I add is:
app/build/intermediates/merged_assets/debug/out/searchplugins/test.xml
After I make these changes and run the app in the emulator to test it out, the changes that I make are reversed/undone/overwritten, and the notice pops up saying "Files under the "build" folder are generated and should not be edited".
What should I do to make my changes save here? Why are the files being reverted back to before I changed them?
Thanks for your help
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