Suppoting android 1.6. VerifyError.

by Kirill » Fri, 18 Mar 2011 21:17:44 GMT


Sponsored Links
 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

-- 



Re: Suppoting android 1.6. VerifyError.

by Kostya Vasilyev » Fri, 18 Mar 2011 23:45:50 GMT


 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 --


Sponsored Links


Re: Suppoting android 1.6. VerifyError.

by Doug » Sat, 19 Mar 2011 01:49:32 GMT


 Basically, you want to prevent the VM from trying to load classes that 
contain references to classes and methods that don't exist in the target 
platform.  Wrapping the immediate code with a check for SDK_INT doesn't 
prevent the JVM class loader from trying to make sense of the symbols in a 
class at run time.

Doug




-- 



Re: Suppoting android 1.6. VerifyError.

by fadden » Sat, 19 Mar 2011 08:04:44 GMT


Other Threads

1. Analytics for Android Apps - issue getting the SDK

This is not a Google Analytics list. You might consider posting
someplace specific to Google Analytics:

2. Market update, showing horizontal icon list for apps per group

For the first time today the market on my G1 is showing the horizontal
list of icons for apps per group. I always noticed this feature in a
screen shot on Androids market update post but it never appeared on my
phone. Was this a fix that started today or was there something wrong
with my over the air 1.6 update?

--

3. How native Gallery is reading bigger images!

4. How to get addresses for Street Intersection

5. Play MP3 in background with built-in player activity ?

6. sending over WiFi

7. how to write multiple-version compatible code...