Fixed 2 strict mode errors. Moved sql call to asynctask and closed several cursors.