new Intent loading wrong xml files - android

I noticed today in one of my apps that when I loaded a new Intent for a certain few classes(these classes are determined from the click of an object on a Spinner), the layouts appear and they are like the original plain layouts I started with in my project, not the ones I updated and changed to make look better.
I checked all my code and everything, there are no xml files for what it's loading(they are old ones that I had used before). I don't understand why these old, non existing xml files are even loading. It should be loading the current ones I have in my project but it doesn't... Can someone help me with this problem? Thanks

If you're using eclipse, you can try doing Project > Clean, and then Refresh your project. This should make sure you are building with the latest resources.

Related

Layouts are not displayed in identical projects in Android Studio

I just copied an Android Studio project into a new folder and want Android Studio to work on the new folder from now on. Unfortunately the layout files are not correctly displayed (I only see a grey layout without any elements) and I get the message that "This project does not use the Gradle build system". I do not undestand why this error occurs. I have not added or deleted anything from the original files and projects. I invalidated the cache and restarted but the problem still exists.
Does anyone have a clue what I have to do? I'd appreciate every comment.
Do you have an idea what the problem might be and what I have to do. I'd be quite thankful for your help as I do not know what to do.

Why the editing area or the main activity of Android studio where we design our UI can't be seen?

I'm a newbie to Android studio and is going to start with my first project.
As per a tutorial, I created an empty activity project. But when my project screen opens, I can neither see any main file that is created after making a new project nor I can see the editing area where buttons, text, etc are dragged to make the UI.
I can only see a black screen on the right side with some tips and 2 folders on the left side - Gradle files and project.
So where's the problem? And how to fix it. I searched this question on many sites but was unable to find an easy and understandable answer. Pls if anyone can answer, I'll be obliged...
EDIT
As this was my first question on SO, the question was poorly stated and formatted. Apologies for that...
Although, I have solved what the problem was (was a silly first-time thing), I am attaching a screenshot of the problem(it's not the exact same as what I was encountering 2 years ago but similar to it) image.
One needs to wait for all the Gradle background tasks to finish and needs to expand the app folder to see java classes or layout files, drawable etc..
Take a look at the docs on how to make a new project and the project folders hierarchy
here https://developer.android.com/training/basics/firstapp/creating-project
Mainly after you create a new project and open it, you will get two main folder app and Gradle scripts, so in order to access your project packages you only need to expand the app folder then you will find the manifest file, java folder where you will find your project activities, and a res folder, here you will find your main ressources folders like drawable, layout and values.
In order to change and add UI elements you need to access the layout folder and that's what you are asking for.
So to resume, to access the java code
app > java > com.example.myfirstapp > MainActivity
To change and create your UI
app > res > layout > activity_main.xml

Is it possible to recover overwritten files from Android Studio?

For a mistake i've overwritten my two project that has same names from android studio and i've dismissed that action today i've tryed to open the main project and i've found no Java classes in it and just the layout's files.
While in the second project to which i was overwritting there is a huge confusion of files and trying to recover the project version by using history of Android Studio even those files has disappeared.
Is it possible in anyway to recover the whole project?
Ps: all that remain from that project is a generated apk.
I have some solutions that may work.
Candidates are:
Search for $AppData$ folders
Search for registries
(Hardest) you may have to preserve the disk state and carve the files yourself..
Cheers, and hope it helped..!
To use the third method(file carving), you may not cause many file operations occur!!(The system may overwrite the previous data)
Hopefully you used source control such as git or svn and it is a simple matter of reverting to the last commit you made, however that is done in your chosen source control. If you don't use source control, perhaps this will serve as a lesson to do so in the future.
I've not used Android Studio, but as a JetBrains product like IntelliJ, it will have a local history record of changes. But that would only record very recent changes.
If that doesn't work, you may have to find out if your chosen operating system backed up the files in a restore point etc.
If you have turned on the file history, you can use that to go to a previous version of the folder. Can also use system restore to go back to a previous date. Can also use third party softwares such as Recuva to get deleted files back.
Make sure to keep a copy of current state somewhere before trying these out.

Creating a project to be reused

I'm sure you can help such a newbie like I am.
I created a project in android and I want to use it as a model for next 10 and more apps, just changing the raw sources.
I mean I want to make some products i.e. 10 videocharts about norway, I make one project with the needed activity and resources so each app will differ only for the content value.
I will keep of course the same file name too if needed.
How can I save the project?
Cause I tried to make a new project from resource but I get an error on top of the tab saying Manifest is not present in the folder while manifest is actually there, and I cannot proceed further.
Thank you
ANgelo
This sounds like a place to use an Android library project.

Refresh list of drawables in Eclipse?

When I add drawable resources to my project they do not show up in the list of drawables in the Reference Chooser. I checked the R file and there are references for the files.
I have tried refreshing the project, cleaning the project, and fixing project properties and nothing seems to help. Sometimes a couple will randomly show up in there, but not all of them.
The only consistent way I can get them to show up is to restart Eclipse.
Any ideas?
Thanks
Edit: Further findings:
After some trials, I found an other inconvenient work around to he issue. Turns out when importing multiple files into the project at once, Eclipse will only add the last one imported into the reference chooser. So when I imported my images one at a time, they all show up properly!
Like I said, inconvenient considering the amount of images I have left to import, but maybe with this new information it may help nail down where the issue may be and a possible fix.
I too faced the same problem. I added an image to the res/drawable-hdpi folder, cleaned the project and was able to see the name of the image in the left pane in Eclipse. But when I tried to use this image using Reference Chooser and looked under Drawable, I didn't find it.
I simply exited from Eclipse, and started it again. It was there! Like many things in computers, problems can be resolved simply by restarting!
The only way I found to fix this is to include the generated R class itself.
I found out some new info again.
Since I am doing a port from Blackberry, almost all of my images' filenames have uppercase letters in them, so I end up importing them all and then having to rename all the images after they are imported into the project.
I tried renaming all of my images before importing them all into the project. To my delight, all of the images showed up right away in the reference chooser! So it seems there is a problem when you import files and they cause errors with your project and allowing all of them to show up in the reference chooser.
So if you have to rename files, do it before import!
I'm just not entirely sure that this is the only cause for this issue but it has solved the problem for me.

Categories

Resources