I am using NetBeans and nbandroid to build my Android app. Previously I was targeting API level 10 (2.3.3) but I realized that in doing so I would be excluding too many people from my app and (I thought) my app did not use any features that exceeded API level 7. However, after changing my API level in project properties in NetBeans, my project will not compile and fails on compiling a myString.isEmpty() conditional. I know this is easily fixed/replaced, but is String.isEmpty really not available until API level 10? If not, how do I fix my nbandroid project? I have noticed that even after I choose API level in project properties, under libraries it always says Android 2.3.3.
I am using NetBeans and nbandroid to build my Android app. Previously I was
Share
It probably still says your using the 2.3.3 library as you have
targetSdkset to 2.3.3.With a Min SDK of over 2.2 (8) you will lose 27.1% of the audience
With a Min SDK of over 2.1 (7) you will lose 6.2%
With a Min SDK of over 1.6 (6) you will lose 0.7%
so it’s up to you if you don’t want to target over 2.3 (9).
(I would personally recommend having your minSdk as 2.2 (8) and targeting 3.0 (11))
As for String.isEmpty()
or
For a complete isEmpty implementation you need to remember your string may be null or full of spaces (which is technically empty):
Checking for null allows you to call the
trim()method without a NullPointerExceptionRef:
Stats reference