I’ve been messing with Android for a couple of weeks, i found many tutorials to follow, but i didnt find anywhere some “Style rules” to make the code looks better.
I would like to know if its possible (im sure that it is, but dont know how to make it xD) to use more .java files to organize the functions. I mean, right now, i have myApp.java where i coded all my application, but is starting to grow so much, so i would like to separate some functions into another .java file.
As i told before, im almost sure that this is possible, but i dont know how to link that second file so, can anybody help me?
Thank you in advance 🙂
If I understand you correctly you haven’t really learned how to use classes in your application? My suggestion is to do a Google search ‘Java for beginners’ and look for references to Classes and objects.
You normally don’t “link” a file in Java as opposed to some other programming languages. In Java you have java files that compile to class files and use them by creating instances of them like so.
Where
MyClassis defined in a file called MyClass.java (and located in the same package/folder as your main application). If you are unsure about package another Google search can illustrate how to use them.If you are using Eclipse, it can help you with this. You can create a class and use it by creating a new instance of it in your main application.