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. OpenGL EGL 1.0 Context sharing does not work

Hello,

I have problems sharing texture resource between two OGL contexts.

I have created two OGL contexts using
EGL10.eglCreateContext(EGLDisplay display, EGLConfig config,
EGLContext share_context, int[] attrib_list) method. Then creating
second context I pass the first OGL Context as parameter
"share_context". By OpenGL specs this means that resource (like
textures, VBO's) should be shared by these two contexts.

After I do makeCurrent with these contexts in two separate threads
(one using windowSurface, another - pbufferSurface).

But the problem is if i load texture into the first OGL context I can
not access this resource from the second context. It looks like these
contexts do not share resources at all.

Can somebody confirm this is a bug in OpenGL implementation?

Tested on Emulator, G1 and Milestone.

Context creation code:
mEgl.eglCreateContext(mEglDisplay, mEglConfig, EGL10.EGL_NO_CONTEXT,
null);
if (mEglContext == null || mEglContext == EGL10.EGL_NO_CONTEXT) {
  throw new RuntimeException("createContext failed");
}

mSecEglContext = mEgl.eglCreateContext(mEglDisplay, mEglConfig,
mEglContext, null);
if (mSecEglContext == null || mSecEglContext == EGL10.EGL_NO_CONTEXT)
{
   throw new RuntimeException("Secondary createContext failed");
}

-- 

2. How can I get a signal which indicating the web server is down?

You can perform an HTTP GET and if the response code is 404 or if you
get a timeout, then the page is down. HTTP Head might also prove
useful for you.

You should be able to specify the timeout period too so that you dont
wait too long.

Eddie




-- 

3. Android 2.2, Stagefright, and HTTP Progressive Streaming

4. How can I get a signal which indicating the web server is down?

5. Kindle for Androi

6. Root Spica & unroot?

7. aplikasi kayak friend stream