question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

When is onCreate called ?

See original GitHub issue

Hello !

I cloned my android project sources to a new machine and tried Android Studio 2.0 (possibly unrelated to my issue), and now my app complains that the tables I’m using do not exist.

I do the calls to init and terminate in the onCreate and onTerminate in my application (by extending SugarApp), but the database schema is never created on a fresh install on a new emulator.

Can this possibly be due to the new Android SDK ?

I don’t understand when or where and by whom the onCreate of SugarDb is called. I’m new to Android, I know the OS itself handles the calls to the onCreate of my app and activities, but how are the calls to the SugarDb event listeners handled ? If the OS calls them, where do SugarDb registers itself to the OS ? I can’t find it in the source for the life of me and I’m pretty sure that should be done when the app installs itself on the phone.

I have the same “error” (no schema in the database when I first try to access it) on both versions 1.3 and 1.5 of sugardb. It’s probably stupid, but I’ve slept on it twice now and I’m still confused.

It worked fine on my other machine (which now is dead beyond repair after a decade of faithful services).

The whole sources of my learner’s app are available here : https://github.com/Give2Peer/g2p-client-android

(disclaimer : the code WILL hurt your eyes, sorry about that ; I’m learning)

Has anyone managed to run sugardb on the new (2.0) Android Studio ?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5

github_iconTop GitHub Comments

2reactions
Gouttecommented, Apr 12, 2016

And if anyone else reads this and needs to switch to master too, I did it with https://jitpack.io but I had to upgrade Gradle to 2.12 too.

Sugar’s giving the sweetness, now. 🍬

1reaction
Gouttecommented, Apr 11, 2016

Thanks for the tip and the pull request ! Will try the master branch.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Is onCreate called when an Activity object is created?
We do not call the onCreate() method ; it is called automatically when you start an Activity from intent. – Houcine. Dec 25,...
Read more >
Android: When does application's onCreate() method get ...
onCreate() - called before the first components of the application starts · onLowMemory() - called when the Android system requests that the application...
Read more >
Android Activity Lifecycle - MindOrks
onCreate() : When a user first opens an activity than the first method that gets called is called as onCreate .
Read more >
Who calls the onCreate(Bundle) method? - Quora
OnCreate is called only once in the lifecycle of the activity that is why we set our views under this method. OnStart is...
Read more >
The activity lifecycle - Android Developers
An Activity is an application component that provides a screen with which users can interact in order to do something, such as dial...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found