java - Parse database initialization- app crashes when navigating back to MainActivity -


when project starts it's fine. mainactivity starts , navigates page when navigate mainactivity error. http://imgur.com/fvhwmhn i'm positive calling parse.enablelocaldatastore before parse.initialize here code mainactivity

    parse.enablelocaldatastore(this);      super.oncreate(savedinstancestate);     setcontentview(r.layout.activity_main);      parse.initialize(this, "my_info", "my_info_again");      // check if user not cached     parseuser currentuser = parseuser.getcurrentuser();     if (currentuser == null)     {         // prompt user loginorsignup screen         intent intent = new intent(mainactivity.this, loginorsignupactivity.class);         intent.addflags(intent.flag_activity_new_task);         intent.addflags(intent.flag_activity_clear_task);         startactivity(intent);     }` 

local data store called before initialize still crashes. don't it. can communicate data base fine , navigate main crashes

you should initialize parse sdk in separate class follows

public class sampleapplication extends application {    public void oncreate(){        super.oncreate();        parse.enablelocaldatastore(getapplicationcontext());        parse.initialize(this, "parse_app_key", "parse_client_key");         parseinstallation.getcurrentinstallation().saveinbackground();    } } 

important!!! need put class info in androidmanifest.xml file. hope helps!


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -