Brilliant - Now trying to extend

Bill
2013-06-09
2013-06-12
  • Bill

    Bill - 2013-06-09

    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:

    display.setText("Books available: " + getAvailableBooks().size());
    
    (Where 'display' is linked to a TextView entry)
    

    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

     
    • Mark Dexter

      Mark Dexter - 2013-06-09

      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:

      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:

      display.setText("Books available: " + getAvailableBooks().size());

      (Where 'display' is linked to a TextView entry)

      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


      Brilliant - Now trying to extend


      Sent from sourceforge.net because you indicated interest in
      https://sourceforge.net/p/eclipsetutorial/discussion/714285/

      To unsubscribe from further messages, please visit
      https://sourceforge.net/auth/subscriptions/

       
      • Bill

        Bill - 2013-06-12

        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

         

Log in to post a comment.