Firstly, many thanks for the excellent eclipse 'total beginner' tutorial.
I'm now trying to extend it as a learning exercise so that it runs as an Android application. I've managed to get it to run in a basic form on Android, but I'm quickly finding the limits of my understanding on the Java side!
My current problem, which I would appreciate anyone's advice on is as follows...
I have defined a new starting activity which has a series of buttons to perform different actions. The first button runs the MyLibrary Class, which still runs the "Test drive library" and writes the status report to the console in debug mode. My intention is to allow other buttons to check books in and out etc, but before getting too complicated I'd like to be able to create a few library status messages in a TextView message e.g. number of books currently available, based upon the test library.
I'm currently trying to work out to access the methods in the MyLibrary Class from within a different class? If it were within the same Class then I think I can use the following:
Unfortunately it seems that I can't just prefix it with the Class name, which I was hoping might work! Please can anyone point me in the right direction??
Kind regards
Bill
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I think you just have to instantiate a MyLibary class object and then
use that variable to call the MyLibary class methods. So something
like:
ml = new MyLibrary("Test");
... <code to set up MyLibrary with correct data -- maybe from a saved
serialized version from the last session)
display.setText("Books available: " + ml.getAvailableBooks().size());
Firstly, many thanks for the excellent eclipse 'total beginner' tutorial.
I'm now trying to extend it as a learning exercise so that it runs as an
Android application. I've managed to get it to run in a basic form on
Android, but I'm quickly finding the limits of my understanding on the Java
side!
My current problem, which I would appreciate anyone's advice on is as
follows...
I have defined a new starting activity which has a series of buttons to
perform different actions. The first button runs the MyLibrary Class, which
still runs the "Test drive library" and writes the status report to the
console in debug mode. My intention is to allow other buttons to check books
in and out etc, but before getting too complicated I'd like to be able to
create a few library status messages in a TextView message e.g. number of
books currently available, based upon the test library.
I'm currently trying to work out to access the methods in the MyLibrary
Class from within a different class? If it were within the same Class then I
think I can use the following:
Unfortunately it seems that I can't just prefix it with the Class name,
which I was hoping might work! Please can anyone point me in the right
direction??
I'd been trying all sorts of other variations on this so many thanks for your help. I'll now push on and see how far I get before hitting the next hurdle - Hopefully a little further each time!
Kind regards
Bill
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Firstly, many thanks for the excellent eclipse 'total beginner' tutorial.
I'm now trying to extend it as a learning exercise so that it runs as an Android application. I've managed to get it to run in a basic form on Android, but I'm quickly finding the limits of my understanding on the Java side!
My current problem, which I would appreciate anyone's advice on is as follows...
I have defined a new starting activity which has a series of buttons to perform different actions. The first button runs the MyLibrary Class, which still runs the "Test drive library" and writes the status report to the console in debug mode. My intention is to allow other buttons to check books in and out etc, but before getting too complicated I'd like to be able to create a few library status messages in a TextView message e.g. number of books currently available, based upon the test library.
I'm currently trying to work out to access the methods in the MyLibrary Class from within a different class? If it were within the same Class then I think I can use the following:
Unfortunately it seems that I can't just prefix it with the Class name, which I was hoping might work! Please can anyone point me in the right direction??
Kind regards
Bill
I think you just have to instantiate a MyLibary class object and then
use that variable to call the MyLibary class methods. So something
like:
ml = new MyLibrary("Test");
... <code to set up MyLibrary with correct data -- maybe from a saved
serialized version from the last session)
display.setText("Books available: " + ml.getAvailableBooks().size());
Hope that helps. Mark
On Sun, Jun 9, 2013 at 10:00 AM, Bill billqq@users.sf.net wrote:
So simple... When you see it done properly!!
I'd been trying all sorts of other variations on this so many thanks for your help. I'll now push on and see how far I get before hitting the next hurdle - Hopefully a little further each time!
Kind regards
Bill