简体   繁体   中英

Can't cast Holoeverywhere application to getapplicationcontext

I have extended the application class to add some preference to my app, i started to implement holoeverywhere, and now i'm getting this error:

03-28 10:39:10.020: E/AndroidRuntime(12511): java.lang.ClassCastException: org.holoeverywhere.app.Application cannot be cast to com.myapp.Globals

in this line:

Globals global = (Globals) getApplicationContext();

Thank you.

import org.holoeverywhere.app.Application;

public class Globals extends Application {
  ..
}

<application android:name="com.package.Globals"
  ..
/>

Globals application = (Globals) getApplication();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM