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. How to display an animated GIF file

Hi,

I just want to display an animated GIF file. I tried and its static
only, its not animating. There are other ways like frame by frame or
using animation classes.

But I want to know, whether android supports animated GIF image.

Thanks
Nithin
--~--~---------~--~----~------------~-------~--~----~

2. handling location error conditions

Hi,

i have similar problems, so if hope that somebody can help us.

and wait for a location update to arrive?

What will be, if you have only the last location and you stop the app
and return to it later and than you want to start a tracking; the
error can be get great. Therefore, I have found a source code (not
tested yet, but it looks fine).

A new question is, what can I done, if I get periodic updates with the
requestLocationUpdates(.., minTime, minDist,...) and now the user want
to get the current location at a specific point unperiodic (minDist =
100m and the user wants to save the point only 50m away from the last
point for example)


Thanks,
Stefan

--~--~---------~--~----~------------~-------~--~----~

3. I want to know to get browse history on android ?

4. Audio input- capturing external audio

5. multiple selection in drop down list -spinner like widget

6. Efficiency of requestLocationUpdates() and how to save these gps data

7. Default keyboard pop up