On my Android project I have the main Activity called TestFIO, which is in the package org.testing.file.io.main, and I tried to keep it clear and sent all the functions I had to a new class called FileManipulator, which is located at org.testing.file.io.main.manipulator. Here is how the FileManipulator class looks like:
package org.testing.file.io.main.manipulator;
// imports here
public class FileManipulator extends TestFIO {
public String readFileFromCard(String location) {
// some code here
}
// more functions here
}
And here is an example of TestFIO:
// header with package and imports
import org.testing.file.io.main.manipulator.FileManipulator;
public class TestFIO extends ListActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final String[] fileString = readFileFromCard(Environment.getExternalStorageDirectory() + "test.txt");
}
}
The problem is that Eclipse is underlining readFileFromCard and showing the following error:

What am I doing wrong or how is the correct way to organize my code in packages?
PS: Sorry if this is a dumb question, I’m coming from iOS development.
The compile problem is because you’re trying to call a method defined in a subclass from the superclass. Inheritance doesn’t work that way; subclasses inherit all public and protected methods from the superclass, but superclasses don’t know anything about the methods of their subclasses.
Additionally, it doesn’t seem reasonable to have
FileManipulatorextend yourActivityclass. DoesFileManipulatorpass the “is-a” test, in other words, is it a kind ofActivity? It seems more like it’s a “helper” class that theActivitywill use to do its work. In that case,FileManipulatorshould not extendTestFIObut rather be stand-alone, created byTestFIO.