Android: Add themes to existing project - java

I have a really old app that I am updating and want to use modern theming methods, probably Material Design 3.
If I create a new Android project, it creates some special folder to res/values folder, which has two files - one for light and one for dark.
I am unable to figure out how to add this special folder to my existing project as it looks like this at the moment.
I couldn't find a tutorial online, and when I try to add a folder and call it themes, it doesn't have the same icon.
Can someone help me with this?

I managed to fix this myself. I compared, and made similar, files in the root project directory between the files in my project and a new Android project.
I had also edited .idea\name file.
Then I just did Build->Clean Project, and closed and re-opened the project in Android Studio, and the issue was fixed with the smart folder organisations automatically done by the IDE.

Related

Why cant I see Java project view in VS Code?

So I'm trying to add jar files to a java project.
I've been told the following:
If you want a more beginner-friendly way of adding libraries, you can
also use the Project Manager for Java extension, which is included in
the Java Extension Pack. With it, you can click the + icon on
Referenced Libraries in the JAVA PROJECTS view, as shown in this
example. A quick tip if you need to add many libraries from a folder
is to Shift or Alt + click the + icon, which will let you select an
entire folder containing multiple .jar files.
After installing Project manager extension and creating a new Java project in VS code, I get to this screen.
As mentioned by VS code, I should be able to see the project view tab after creating my java project. The issue is I don't see the project view tab as shown in the image above. VS code says I should see the 3 dots by the explorer subheading to enable it, but again, I don't have these 3 dots as shown in the first image.
I have both project manager and the extension pack installed, so I really don't understand why I cant see or enable project view.
Any suggestions on enabling project view?
Have you tried to open a java file? Because the extension activated depends on the opened filename extension.
You can refer to here.
If it still does not work, could you provide the OS and the versions of the
VSCode and extensions?
I have struggled quite a bit with this and none of the 'obvious' solutions worked.
The way I ended up solving the issue is by creating a new Java Project and looking at the difference in the config of the files.
Especially in the .project file, there were missing entries. Some also in the .settings/*.prefs files
After updating those in my own project, it got detected properly.
As for the 3 dots, here's what I think: different versions may be slightly different, you see, there are no three points in this one enter image description here. So you may update it when you are free.
As for the project view, you may have to open a project before it appears, Steven-MSFT has said it in detail, you can see it first. If you still have questions, you can provide some details again.
Anyway, you can try the following 2 steps:
open a .java file
reboot your vscode

After creating android project in Eclipse ADT, tons of errors show up

I'm using eclipse ADT (most recent version) to develop some android apps. I've followed the getting started tutorial at the dev.android.com and it worked just fine.
But when i tried to create another project with the same targets and sdk's, i've got nothing but errors:
Some errors and my sdk's:
That's the same sdk's i used before these errors started showing up.
What can be causing this?
EDIT: my project won't generate the R.java file
You might need to add a support library to your new project.
Check this link for downloading the support libraries -
http://developer.android.com/tools/support-library/setup.html#download
Please notice that you need to import them into your eclipse and then include one (preferably the newest, not sure about this) in your project.
EDIT:
Before downloading the support libraries you should first check if you have them already.
Try this, right click project folder in the eclipse package explorer, Properties>Android>Library>Add>select a library if you have one.
There might be an invalid library included in your project already, if that happens then you will see it in the Library>Add> menu, remove it and add a new one.
You might have clean your project ........
if yes.....you must check whether R.java file is present in **Project(your project)->gen->package name->R.java**
if not than u have to update Tool Folder in SDK manager

Importing PhotoView?

Ok so I want to chisbanes PhotoView.. I'm pulling my hair out now, Been staring at the screen for over an hour and for the life of me, I cannot figure out how to get this to even import into eclipse.
I've downloaded the git so I have my PhotoView-master folder with plenty of things in there (Looks like a project tbh). But no jar?
I came across this question which was marked as answered but I simply could not figure this one out.
Android : import libraries Like PhotoView
I went through this
http://developer.android.com/tools/projects/projects-eclipse.html#ReferencingLibraryProject
But once again, there's nothing even available for me to add.
Anyone know what I need to do to actually get this loaded into eclipse and ready to reference?
Cheers in advance
Ok so I managed to get it working after hours slaving away at the screen.
First you need to move everything under the java/uk folder to the src/ folder in Eclipse. Once you do it the src/uk/... should look as normal. Next you need to go the project properties, click on Android and then change the Target Build Path to match the project you will be importing the library into.
Then just follow the instructions on the android dev webpage and then you should be able to reference the required files.
Working with library is a pain in android.
Photo view is not a jar library it is a referenced library. so you have to download the zip and import it inot ecllipse. Also if the library is built using Android Studio then you have to change folders to make it work. For eg the source code in Android Studio is in java folder while in ecllipse it is in src.

Eclipse not creating new .java file in New Project wizard?

OK, I have a really basic (read stupid) question. I am just beginning Java programming, and am using Eclipse 3.7.2. I have done a few beginning projects without any problems. All of a sudden, when I create a new project using the wizard, it is not creating the src/.java file. When I try to manually add it after creating the project, I end up getting some cryptic error messages.
I have re-followed several walk-throughs on project creation for clues as to any option I may have accidentally un-checked and no luck.
Googling the answer brings up results for more advanced problems that are unrelated.
I have combed the preferences, but nothing looks obvious, and
I have gone hunting for any user app data I could delete to force a clean slate.
I have even created a new instance of Eclipse to a different directory and still have the same result.
My son's instance, which is on the same computer still creates the .java file from the wizard. The only difference is that my instances have the Android SDK installed (I am trying to create basic Java projects and not Android projects).
I am at a loss, and have lost a lot of time trying to correct the situation. What do I need to do to reenable the creation of a src/.java file in Eclipse?
Screenshots (click on image for full size):
Make sure you are choosing a java project from the right folder in the wizard. It sounds like it is creating an android java project, which is probably why your src folder is missing. See if there is a helloworld project under example projects too in the wizard, that may get you started too. Screenshot may help us. I want to see which project type you choose and which folder it is in.
How about changing eclipse to point to a new workspace. That may drop the android settings. Under the file menu, choose switch workspace and pick a new location. Thats most likely why a new install did not fix it. That workspace may have android settings in it, so change to a new folder somewhere else to test it like c:\workspace2\
Here's a good tutorial I found that may help too.
eclipse java project tutorial

What is the best way to include another (non-android) project in an android project under eclipse

I'm new to android programming. I'm trying to include code from a non-android project in an android app. This contains shared code used by a lot of my other non-android apps.
I was wondering what the best way to do this is from a code maintenance perspective. The shared code that I want to include does get modified from time to time and I want to keep the process of updating any apps I write as simple as possible (automatic if at all possible).
Am I better to build a .jar file containing the shared code and copy this to my app (eg: using an ant script) or is there a more streamlined approach.
I specifically want to avoid turning my shared code project into any kind of android project.
Make a jar and add it to the android project's build path. Whenever there is an update to jar, you would need to update it in your project and update (increase) version of your app to automatically allow users to download and update the update (android market would take care of that for you).
Its the most widely and maintainable way.
Hope this helps.
Once you have your .jar, you simply have to add it to your project (or update with the new .jar file if this library gets updated).
Once it is in you project (let's say under the /lib folder,
right click on the lib folder -> select build -> add to build path.
Unfortunately, I'm pretty sure there's no way to make an automatic update.
In the projects' properties go to "Project References". It will should you the other open projects and you can click whichever you want.
I haven't tried it, but if you change the non-Android code and run the Android project, I would expect the non-Android project to be recompiled automatically.

Categories

Resources