Please, if someone could write the meaning of refactoring in android, how it is done and what is its use in android programming. I am using Eclipse.
Thanks
Refactoring means making small changes to improve the structure of a program without affecting its operation. So, for example, renaming a method or moving a method from a subclass to a superclass would be examples of small refactorings. Eclipse has a "Refactoring" context menu which automates these and a number of other simple refactorings.
This really has nothing to do with Android, though; it's just a general programming term. There's nothing about refactoring in Android programming that differs from any other system.
I just used the refactoring option in Eclipse to rename my package and automatically rename folders and package references, and found it quite useful! I didn't really know what refactoring meant in this case, until I decided to try it out while playing around with different menu options.
I have had many troubles in the past when I manually tried to change a package name or copy one package to a new one but with a different name, so the refactoring option comes in handy if you want to do it all in one fell swoop.
Related
For a project, I am changing certain ContentProvider-files in the Application Framework Layer of the Android System. As I am trying different things, I was wondering if it is necessary to build the Android Source for every change I make, or if there is a way to somehow emulate the system without the build?
I am not entirely sure what "building" means, as I cannot find a proper definition including Android as a context. I assume it is some kind of compiling?
Converting the source code into an executable program? In that case I do not think there is another way, is there?
But do I understand building correct in the first place? In that case, I would believe there is no other way than building the system every time and then see how it works out.
So I might have the solution right here, but I was hoping someone could assure me that it is right or maybe tell me why it is not?!
Any help is very much appreciated!
Building in this context means that all Android source files are re-compiled by the java compiler and a massive .jar file is produced. This is the Android.jar file that we see in the library dependencies of an Android application project.
Unfortunately, the short answer is that there is no way out for you except to re-compile the entire blob of the Android framework files each time you make a change. What I can advise you is to plan all your changes beforehand so you don't end up wasting a lot of time.
Over the past years, my own library with many helper methods has grown a lot and I kind of lost the vision how to properly sort it.
I tried with simple folder structure like UI/TextView, UI/EditText and so on. My logic was to have the general name for root, then type name for folder, then classes inside. But in time, it so grew that I now cannot find many methods and I discovered that I have multiple duplicated methods.
Can anyone direct me to a good and quality Android helper project where I can see how they sorted their library?
Or is there any public open source project where Android developers contribute with their own helper methods aiming to creating the ultimate helper library? If such thing exist, I would rather fill the gaps with my own methods and use the whole project in my applications, then continue upgrading my own library.
Try this library it's very interesting .
It's the android-bootstrap library , while it's still in the beginning and needs improvements but the necessity of such libraries may make it a very important project , that you contribution to may be very helpful for you and for the community , the design of the library code is easy which makes it easy to understand and you can easily add futures as you want .
In short: Is there a supported way to create an Android project for eclipse (as you would get via the new Android project wizard) programmatically? Or if not supported, then is there any way at all? (this is being done within an eclipse plugin)
I've been trying to do this for a while, and it is turning out to be much more difficult than expected. I took a look at the source for both the New and the Import wizards for Android projects, and found that they both use the NewProjectCreator class. There seem to be two ways to use this class; one is via the static "create" method, and the other is to construct an instance of NewProjectCreator and call "createAndroidProjects". However, I'm having trouble getting ahold of all the necessary parameters for either of these. The static method requires both an IAndroidTarget and a ProjectPopulator, neither of which I can find implementations of (There is an anonymous implementation of ProjectPopulator in the NewProjectWizard class, but pasting this into my code is disastrous in the number of classes and fields it can't find). The instance method on the other hand requires an IWizardContainer, but I would like to be able to do this without bringing up a wizard.
At the other end of the spectrum, I've tried simply adding and Android nature to the project, but this causes all sorts of build errors, since it doesn't actually change the setup of the project to reflect whatever the Android standards are. I guess another option is to take this route and try to set up the whole project manually, but I don't know if there are any guidelines for this, or whether the project standards are likely to change.
Does anyone know how to do this? Thanks in advance!
Ok, so it might be a stupid question that is very obvious... anyway, I am making a new application and I wanted to know if I should make a package for every category of objects,
for example: Monsters, PowerUps, Powers, FrameWork(where I make classes that I implement from) etc.
I am using canvas and a thread class to handle what happens inside the canvas(lockcanvas, unlock and post etc.)
So, should I make everything in one package or few packages, and will it be harder or do I need to know something to use these packages? Thanks!
It's entirely up to you how you group your classes. In terms of coding, it makes little difference as Eclipse will work everything out for you. Instead, consider how you can use packages to help you quickly go to the right place when you return to your code in six months time to correct a bug.
IMHO, your proposal seems to result in a few too many packages for comfort. I don't know how complicated your code is, but if you've only got a handful of classes per package, that's probably a bit too fine. Probably better to break your app into larger chunks of functionality. It's also worth spinning common "helper" or "utility" classes into their own package too.
As with any aspect of coding style, opinions will vary. But I found the following article to be well argued...
Package by feature, not layer
You could get the same organizing effect you are looking for by using folders inside the package to group code without all the hassle of additional packages. Unless you have a special technical requirement for multiple packages I would try to keep things as simple as possible.
I'm not looking for a mock up tool, I'm looking for a reasonable GUI design tool for the final product in the style of Apple's Interface Builder. Droid Draw is buggy, out of date and inaccurate in my experience. Using the Eclipse plug in to do a complex layout makes going to the dentist seem fun. I'd even settle for hand-coding CSS pixel coordinates over the current model. Is the solution found here: http://andrdev.blogspot.com/2010/01/gui-designer.html the best, or have one of you ninjas found something else? If there is an actively developed project that isn't ready for show yet, I'd like to know that as well.
I don't see why you'd want something like this (especially the tool you posted a link to). That would mean learning a whole new language just to use that tool. Why not learn the XML definitions directly? Yes, it's a relatively steep learning curve but once you're up to speed you'll see it's great. Also, doing XML by hand will allow you to optimize your layouts a lot (there are a few articles out there on how to do that).
As to the Eclipse plugin, I find it quite awesome, although I never use it directly. I don't add/remove/edit elements with it. I write my XML code and then test it with the plugin so I don't have to recompile the app > upload it on the emulator > run the app > go through all the activities to get to the one I'm editing right now, just to see that I need to add a little more padding.
Also, in general, it's best to use the tools you are given. Third party tools are very likely to become outdated, discontinued, deprecated, ...
In conclusion: do it the right way. Write your XML by hand. Use the Eclipse plugin as a convenience tool.