I do an import of the full package name / java file, and if I do a <classname>.<method>, SOMETIMES I can get it to access – other times I get a lot of can't use a static in a non static bunch of talk.
I’ll admit I’m new to Java, so what do I need to do? Call a class instance first, then call my methods? I’m rather confused by this, as I want to put all of my ‘functions’ into a FunctionsList.java file, and all of my main Activity (UI) into a MyActivity.java file.
For example:
<MyActivity.java>
import com.example.FunctionsList;
private class MyActivity extends Activity {
FunctionsList.function();
}
9/10 times I get that static/non-static error.
If I put all of my functions into MyActivity.java, I have zero problems! Anyone help me on what I presume is a basic Java newbie issue?
Here’s an example that will hopefully help you out a little.
Then in your activity you have something like this.
As Jon mentioned, you’ll probably save yourself some frustration if you read up on object-oriented programming before diving in. There are some basic things that a new programmer will need to understand before diving in. Good luck!