You can use a version-dependent factory method, something along these lines:
interface IBlah { /* some methods here */ };
class BlahForAndroid_1_x implements IBlah { /* 1.x dependent code here */ };
class BlahForAndroid_2_x implements IBlah { /* 2.x dependent code here */ };
And finally:
IBlah obj;
if (Build.VERSION.SDK_INT > 4)
obj = new BlahForAndroid_2_x();
else
obj = new BlahForAndroid_1_x();
-- Kostya
18.03.2011 15:30, Kirill пишет:
I've got a method like this one. I want to autocomplite e-mail in
EditText. But application crashes
private void setAccount() {
Account[] accounts = AccountManager.get(this).getAccounts();
for (Account account : accounts) {
if (emailIsOk(account.name)) {
((EditText)
findViewById(R.id.email_input)).setText(account.name);
break;
}
}
}
I've tried
if (Build.VERSION.SDK_INT> 4)
But It still crashes.
I want to support android 1,6 and at the same time autocomplite e-
mail in other vesrions of SDK
This is my problem
Thant you
--
Kirill
--
Kostya Vasilyev -- http://kmansoft.wordpress.com
--
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