URl of page - http://developer.android.com/resources/tutorials/notepad/index.html
Under "Preparing for the Exercise" the instructions say to
Download the project exercises archive (.zip).
Unpack the archive file to a suitable location on your machine.
Open the NotepadCodeLab folder.
QUESTION 1 - What is considered a suitable location?
I unpacked the samples to.
- *c:\Development\NotePadTutorieal* -
BUT I don't want to modify the files here. Sometimes I need (or just want to) work the tutorial 2 or 3 times from scratch, and would prefer my base files serve as an untouched template, so I can restart from scratch if necessary. I'd like to have the working code for the tutoriel end up where all my other Android Projects are stored at c:\Development\eclipse... but weather I select "Create Project from from existing source" - or - "Create project from existing sample" it seems to leave the files where they are, and work on them in suite (modifying what I'd like to keep as a reusable template) - Am I missing something?
Thanks in advance for any helpful comments.
Joe
Why don't you just keep two copies? Work on one, and let the other serve as your untouched template.
EDIT: Make a copy of the entire NotePadTutorial folder in c:\Development\eclipse\ and work on it there. Leave the other one untouched.
A suitable location is anywhere on your system where you have read and write permissions. If you want them in the same place as your other project files, copy the sample project directory to wherever you want it and then select "Create project from existing source".
Related
I had created a bulky activity and now I need to modify a lot in it. I decided to first copy paste the entire code on text box but I do not think it is the right way. I want to save the activity consisting of xml file and .java file in a single file that can be recalled if required. Is this possible or should I copy and paste both file to some location manually.
Thanks
In modern Software development it is often a good practice to use some kind of version control system.
A lot of people are using systems based on git like GitLab, GitHub, BitBucket etc.
These tools help to manage your source code in different versions and enable you to switch between versions easily.
In your case you could decide to work with github and after pushing your project you could compare your recent code with the new one until you decide your refactoring is done.
If you decide to dive into this you find many tutorials with google.
e.G https://www.codecademy.com/learn/learn-git
I'm using Android IDE to develop, and I need to move source files from one folder to another, but I can't seem to find a way to actually MOVE a file (even copy and delete in two steps would work).
Am I blind? This seems like a required feature of any IDE, and given how good Android IDE is, I find it shocking if this feature was overlooked.
NOTE: This question is NOT about Android Studio!
You are right. The (essential) feature to move files around is missing from Android IDE.
Workaround:
You can manipulate the files in any explorer. Your project files are placed in /sdcard/AppProjects/YourProject.
You can count on the fact that such a feature will not be missing for long.
I would download a file manager (I like root browser) and switch between the two apps as a temporary work around. That app is updated fairly often so I would also just shoot the developers a feature request. I am sure they would consider it essential as you do.
PREFACE: Use a file manager; this hack renames Java classes.
Rename, with the relative path as the new name.
Let's say I wanted to move file from /sdcard/A to /sdcard/B. I'd long-press on file, chose rename, and type the new destination as ../B/file.
This doesn't seem like deliberate feature, rather a side effect of blindly passing path strings to the underlying framework. Can't say I don't like it, although, I'd recommend using a proper file explorer app.
Right-mouse click on any element (folder, Class, or XML file) the click = 'cut'.
Right-mouse click on the folder where you would like the files to be moved to, and then select 'paste'.
This works the same as moving files in the file-system.
For the most part (depending on where you are moving to and from) you can just drag-and-drop your files to move them as well.
I often achieve this goal by simply drag and drop. And the IDE also takes care of all the refactoring stuff.
I've created an app which pulls data from a JSON file and displays it.
Now that app is specific for one sports team. I want to create the same app for 10 other teams.
Plus there will be an accompanying pro version of the app.
I'll be doing the same thing for the iOS version.
The only difference between the apps will be colors, logos and url of the data source.
I wanted to know if there was a better way to create apps. Instead of individually creating 40 different projects.
It will help me in updating the app as opposed to copy pasting the same code 40X.
Are there any special features available in eclipse and xcode to do that?
Thanks
I would simply swap out the resources for each team and rebuild the app.
For example, with Android, maintain an AndroidManifest.xml and a res/ subdirectory tree for each team. When it is time to build, simply copy over the resources into the project, overwriting the previous team.
I don't know of any existing tool to do this automatically, however.
Have you looked into using PhoneGap and just create a "mobile site" that detects the app that is connecting and adjusts the data/styles accordingly.
There's always the possibility of creating ONE app allowing the user to set the team preference upon first load, and swapping out resources programmatically.
With Titanium Studio you can write code using Javascript and it convert your code in native objective-c code, native android code, native html 5 code and soon also in windows phone code. It`s the best free cross platform IDE
Upon reviewing your responses, you seem to want a strategy to manage your resources. Since different OS has different resource requirements (screen-size, iOS 2x png for example). The most common strategy is to keep a separate resource structure and setup build target to copy/xcopy replace these image resources before build. Source control + an OSX build server would be most beneficial.
After creating these apps I've found the following way to be the most easiest way to create a similar app.
Android:
1. Select the project from the project explorer sidebar copy it and then paste it. Give it a new name.
Select the new project and then right click > Android Tools > Change Package Name.
Give it a new package name. Eclipse will give you an option to refactor the code, say yes.
Go to res/values and change all strings.
Change the icons and other images.
Go to src click the package and then refactor it. Give it the new package name.
Go to manifest file and rename any old names which might still be lingering.
This maybe a continuation from 2 of my previous question, or maybe it's a completely unconnected problem.
Previous questions were
Questions on Notepad Tutorial:
Can't read ... AndroidManifest.xml - while attempting Android Notepad Tutorial - Exercise 1
The tutorial asked you to select "Create project from existing source". My 1st original question was where to copy the template (original source) to and from the answers I received, It looks like I should copy the directory-structure/source under the C:/Development/Eclipse/ directory, so it would look like this
_ C:/Development/Eclipse/Notepadv1/... _
I did that, and then tried to continue the tutorial, but when I got to the part that says to select "Create project from existing source", I received a pair of errors
C:\Andriod\Andriod-SDK-Windows\AndroidManifest.xml: java.io.FileNotFoundException: C:\Andriod\Andriod-SDK-
(Same error prints twice in the Console & WorkSpaceLog
So I posted a second question about the FileNotFoundException:, and received an answer saying to ignore the message, happens all the time... so I deiced to plow forward again. Now I have 2 problem. One of the problems may well be of my own doing, trying to run threw this tutorial dozens of times, and attempting to back out my changes over and over again.
Problem # 1:
I once again start to create the Notepadv1 project using "Create Project from Existing Source" (The cant-read-androidmanifest-xml error still appears), but as suggested I just ignore it. I next select "Android 1.5/Platform 1.5 as the Build Target, BUT the field where you enter the Min SDK Version is grayed out, and you can't enter the number 3 there.. The tutorial says to put the number there, but it seems to become grayed out at the same time I select "Create Project from Existing Source" and get the "cant-read-androidmanifest-xml" error.
Problem # 2:
If I click on [Next] twice, or [Finish] once, I get a pop up box with the message "Invalid project description" - - "Reason: Invalid project description"
[Details>>] "Invalid project description.
C:\Development\Eclipse\Notepadv1 overlaps the location of another project: 'Notepadv1'
".
This did not originally happen. There is no mention of the "Notepadv1" in the Package Explorer or Navigator windows, so I can't find any way to remove it, and I have run Clean Projects, exited eclipse and rebooted the machine a few time... in a few different ways.
Any suggestions? Joe
P.S. I have not yet accept any of the answers to my last question, because the juries still out. I'm not yet sure they were correct. I'll will make sure I go back and accept an answers, once I figure out what the correct answer is - Joe
I had the same issue, and just got it working!
I have no idea how to fix, I'm still getting the error, but It's not hindering me from continuing, so I'm not worried about it.
Is very simple, you shouldn't have copied the Notepadv1 directory into your C:/Development/Eclipse directory, because, when you "Create project from existing source" it copies it there for you. So, the one it's trying to copy from is getting in the way of where it's trying to copy to.
Hopefully that makes sense, and helps.
Problem 1 is because the androidmanifest.xml is missing.
Problem 2 Notepadv1 already exists in your workspace.
If I were you I would change your workspace to your Documents/My Documents or equivilant folder depending on your OS. You can do that under File->Switch Workspace->Other. Then delete what you have under the Eclipse directory. It could get messy if you update Eclipse or have multiple versions of Eclipse.
Where is this Notepad project? Is is part of the SDK? If it is I would use File->Import to copy over to your workspace rather than mess with the SDK copy. That is probably why the manifest is missing.
If you would like more help let me know.
PS. You will probably want to reinstall the SDK if the Notepad manifest is missing.
EDIT:
#Joe. I couldn't say why other tutorials worked and others didn't for definite but using the SDK as a workspace is definitely going to end up being programmatic when you are learning. My SDK is separate from my workspace. So, in a brief summary, I would keep the SDK, the Eclipse source and your project workspace in entirely different locations. And we can start from there if you want more help.
Very Simple, you need to clear the workspace... to do this adopt following 2 steps
Right click on your project and select Android Tools and now select Fix project properties
Select Project from menu and now click on clean.
This will work for sure
Re: problem #2...
My apologies if it's inappropriate to cross-post an answer in multiple threads, but it was asked in a couple of places so in the interest of helping novices with the Android environment (of which I'm one) I'm posting it here as well.
I'm using Vista, Eclipse 3.7.0
I don't know what "File | New | Project | Android Project | Create project from existing source" is supposed to do but I couldn't get it to work for a set of unzipped files of a project tutorial I got from elsewhere. I kept getting that error.
I found what did work is:
1) Copy the unzipped file tree for the project to wherever you want it to eventually reside.
2) File | Import | General | Existing Projects into Workspace | Select root directory:
and point it to wherever you put the zipped files, check-box on for the Project that is the one you want, then Finish
Step 2 seems to not actually move the files anywhere (even though the term 'import' implied that to me), but it seems to just make Eclipse aware of where the project is located and it uses the project from that directory.
That seems to work at least for me.
I'm a newbie with Eclipse and Android. I have a legacy project from an
SVN repository which I could import and use under Eclipse Helios. Also
changes inside and outside Eclipse are synchronized fine with the SVN.
Now the problem: The project structure consists of a root directory,
referring to a src path, which exists outside the root (i.e. on the
same level as the root of the project is). I guess this has been
arranged by the designer, because the src part has been referenced
from different java projects for different platforms. I think this is
not such a bad idea.
However: Whatever I do I can't make Eclipse and SVN synchronize
changes on files located in this "outer" directory. What do I have to
do in order to make both aware of the outer parts, w/o being forced to
change the file/dir structure completely?
Kind regards
From what I understand from your description you did the following ?
You Removed the src folder created by eclipse during the first check out.
You create a linked src folder (when you created it, instead of just accepting all the defaults, you opened the "advanced" dialog box and checked the radio button saying Link...(Linked Folder) and you filled in the location where you wanted that "outer" src folder to be located).
You updated from the repository.
But when you look at the updated folders, the src that has been updated is really under the root rather than the one you have shifted away.
Can you confirm my understanding ?
If not, then you might try the procedure outlined above.
Unless there are twists in the ADT I don't know about (a little bit like in hierarchical maven projects where you can "export as Maven subproject"), I cannot see any other scenario that would lead to the problem you describe.