Thursday, June 24, 2010

Prom House Rentals In The Poconos

do without the final keyword

In the test mentioned in the last post I had to click on the button associated with inserting a new record in database and then notify the SimpleAdapter that the database had been modified and therefore would have had to redesign the ListView.

In doing so the compiler I had an error, because the classes of the database and the adapter were in fact instantiated in the OnCreate function, launched the application is started. The life cycle of these variables end with the end of the function itself, so when you click the button no longer exists, hence the error. The Eclipse compiler kindly provided the suggestion to turn in final these variables.

The keyword final Java use has varied and complex, as we are concerned say that we need to preserve the value of the variable once the function has finished its work and then you can use it in other functions .

anddev.it A comment received on the forum and found some hints as I documented and studied how to create the dialog, made me realize how do without the final: just its reporting the two variables as private members of the class , dare I say it a truism.

0 comments:

Post a Comment