• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

why oncreate doesn't run always

 
Ranch Hand
Posts: 1325
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Below is my db helper class



below is my main class



when i run this code 2nd time it doesn't run the OnCreate mehtod in the DBHandler class.why it doesn't run each time ?

 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The lifecycle of activities is explained in extensive detail in the javadocs of the Activity class. I seem to recall pointing you to it more than once. If, after all these months of programming for Android, you still haven't internalized it, then, frankly, you're doing something wrong.
 
shawn peter
Ranch Hand
Posts: 1325
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I know oncreate called when activity initiated.But i have installed the all again.even then oncreate doesn't run.
 
shawn peter
Ranch Hand
Posts: 1325
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think i found the answer.

http://stackoverflow.com/questions/21881992/when-is-sqliteopenhelper-oncreate-onupgrade-run

anyway Thanks ULF for your helping.
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

But i have installed the all again.even then oncreate doesn't run.


That sounds very odd, not to say highly unlikely. Stopping an app (via the Settings) or uninstalling/reinstalling it will definitely cause an app to be terminated (and thus cause onCreate to be run the next time it is started). If you can reproduce that that is not happening for your app, then that would be a grave bug in Android.
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ah, you were talking about DBHandler, not AndroidSQLiteTutorialActivity. That would have been very useful to have been mentioned.
 
reply
    Bookmark Topic Watch Topic
  • New Topic