01-28-2009 07:29 AM
Well i swear, i tried the code exactly as above - it throws the error.
i can provide you with a screenshot later that day, when i'm home again... :-)
Sure i'm in the "younger Java-Developer Generation", so i have to lern much.
i know, that this code will fail, if sb. will add another field bellow this one, but i think,
then you can say: "Your code will fail, if someone change the name of this function...."
Currently im not trying to build a "open Source" Application - so if sb. like to change sth
in the code, he has to change it in a way, that it works.
In my Case the required field is the last in the List.
This all sounds like i dont appreciate your hint, but indeed i do!
01-28-2009 08:27 AM
No worries, just trying to help, glad it is appreciated...
Re "Your code will fail, if someone change the name of this function....".
In fact, the code will not compile, which is a much easier problem to fix.
For maintenance reasons, I try to minimize the places that need to be changed and make it obvious which places need to be changed too. My suggestion helps in both regards, because if you are changing the Screen, then you don't have to remember that something else has hooks into it, and the Screen knows what it should do with the text that comes from the background Thread.
Re the code not compiling, don't worry about the screen shot. When you have tested it, just tell which line it complains about and what level JDE you are trying, and I will test it.
01-28-2009 12:29 PM
With the code Fail/Compile Statement, you're right again :-)
Unfortunately i dont understand the question "What level JDE do you..."
Here is a Screenshot, of the code, quickly build in, and the resulting error...
(the first trycatch is there, cause "maybe" the user or another application may delete or change
the file, while reading it...)
i think the second one - in the runnable - it not needed anymore, but we talk about the
failure that appears ;-)
01-28-2009 01:38 PM
In my code I have:
catch (Exception e)
In your code, from the screen shot you have:
catch (IOException ioe)
and it is complaining about the fact that IOException is never thrown in the try - which is correct.
Without being rude, this is the sort of problem that you learn about when starting Java. I suggest you buy a 'teach yourself Java" book. There will probably be Sections or Chapters on Object Orientation, Classes, Inner Classes, scope of variables, Exception handling and so on that are very applicable. The BB is not a good Java teaching platform, you really need to understand Java before you start programming on the BB.
01-28-2009 02:45 PM - edited 01-28-2009 02:46 PM
hmm, seems like you're right again ...
Well i started with Java because of my Blackberry.
Actually i have no time for reading books :-D (study exams)
But for the next term i subscribled to a course called "Java" :-)
Then - i think - is the right time to buy a book ^^
Thx for all your hints and ... "truths"