android - How To Get Application Context After Force closed -
i integrated c2dm in application working fine. once c2dm notification came database operation need context create ormlitesqliteopenhelper object.
ormlitesqliteopenhelper ldatabasehelper = openhelpermanager.gethelper(context.getapplicationcontext());
this fine in normal cases.
suppose if force stop application manually settings-
application->manageapplication. if c2dm message came after unable create ormlitesqliteopenhelper object. seems application context getting null.
exception : java.lang.illegalstateexception: not find openhelperclass because none of generic parameters extends ormlitesqliteopenhelper: null
how application context after force stopping application.
i tried cases: context.getapplicationcontext() , context, this.
please me .
it might solve problem if explicitly tell ormlite name of databasehelper class.
to this, open res/values/strings.xml, , add
<string name="open_helper_classname">your.full.package.name.databasehelper</string>
( http://ormlite.com/docs/android paragraph 5)
Comments
Post a Comment