Seriously, this never ever worked: String imageFileName; String theString = imageFileName.toString().
Calling toString() on a null object has always and will always result in a NullPointerException. On Sat, May 16, 2009 at 2:41 PM, chrispix <[email protected]> wrote: > > Actually it did work prior to 1.5, it appears it has been fixed. You > should give it a > whirl! Thanks for the heads up on that.. Trying to make the migration > from .NET to > Java and some things that appeared like they would work apparently > have changed > some. > > Thanks again! > > Chris > > On May 16, 1:02 am, Romain Guy <[email protected]> wrote: > > It couldn't have been working before 1.5. The only way to safely > > convert an object to a String without a NullPointerException is to use > > a StringBuilder/StringBuffer or use a String concatenation: > > > > String imageFileName = "" + myFile.imageFileName; > > > > Or better yet, explicitly check for null :) > > > > On Fri, May 15, 2009 at 10:10 PM,chrispix<[email protected]> wrote: > > > > > if the value of imageFileName is null, why can I not change null into > > > a string? It was working before 1.5. > > > String imageFileName = myFile.imageFileName.toString(); > > > > > This gives me the a NullPointerException Error. > > > > -- > > Romain Guy > > Android framework engineer > > [email protected] > > > > Note: please don't send private questions to me, as I don't have time > > to provide private support. All such questions should be posted on > > public forums, where I and others can see and answer them > > > -- Dianne Hackborn Android framework engineer [email protected] Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

