The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.

Re: Newb question: Using the same object over two methods?

Thanks for the response but I'm still not sure I understand.

I define 'e' in the onLocationChanged method and then use e.putString to 'save' it to the object. If I define 'e' again in savePosition() won't that create a new object and therefore not have the data available to save when using e.commit()?

Re: Newb question: Using the same object over two methods?

Wow, thanks for the fast response.

Okay, sorry if I sound ignorant but if every time I define 'e' to be able to access it within different methods then really what my question should be is, what is the best way of passing or reading the lngString and latString variables from onLocationChanged?

I've tried moving the entire 'e' object into the savePosition() method and then defining the strings as 'final' thought I am still unable to read them.