You might not want to do what you want directly in the activity. You
might want to create a different class and put the necessary calls in
that. Then you can instantiate an instance in the oncreate method.
Typically oncreate is a good place to initialize GUI components and
callbacks.

Cheers.


On Aug 11, 4:10 am, Scott Herbert <[email protected]>
wrote:
> Firstly I hope this isn't too basic a question, I'm new to Java (and
> be extension Android) so please forgive me if it's obvious to everyone
> else, but I couldn't find the answer via Google.
>
> I have a simple app I'm writing primary because I and at least one of
> my friends want it but also to learn Java. Part of this application
> pulls a database from the resources and copy's it so it can be
> accessed via SQLite, and I use a class that extends SQLiteOpenHelper
> to copy the database.
>
> And here lies the problem, as soon as this class exists (the
> constructor is called) I get a runtime exception, comment it out it
> runs fine.
>
> I think this is because the constructor is setting a String (db_path)
> that is used by onCreate, and so if onCreate is fired before the
> constructor it tries to use db_path and fails because it's not set.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to