You should do this based on API level. If an API is not documented as available prior to a particular version, there are no guarantees what any existing method would do in the earlier versions. For example, not infrequently a new API is being developed but hidden from a particular release because it is not ready yet due to being buggy or other reasons that could cause you trouble. (I have no idea if that is the case here, but best to be safe.)
On Mon, Dec 13, 2010 at 7:59 PM, Zsolt Vasvari <[email protected]> wrote: > As per the StrictMode article ( > > http://android-developers.blogspot.com/2010/12/new-gingerbread-api-strictmode.html > ), I devided to switch over using apply() instead of commit() for my > SharedPreferences. > > So I wrote my nice conditional logic based on the API level and to > test to see what happens, I ran it on my 2.2 Nexus One, fully > expecting a VerifyError because of the missing API. To my surprise, I > didn't get that error. So I fired up the emulator and confirmed that > all the day down to Level 7, the supposedly new API does not trigger a > VerifyError. It does level 4 or below as expected. > > What's going on here? Has the apply() method really been there since > Level 7 undocumented? If so, is it safe for me to check if the > current API level >= 7 and use apply()? > > -- > 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]<android-developers%[email protected]> > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- 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

