Maybe you can use ActivityName.this
mDbHelper = new NotesDbAdapter(ActivityName.this);
mDbHelper.open();
or make a static store in a class, ie:
public class MyClass {
public static Context contextShared = null;
}
and when the activity starts
protected void onCreate(Bundle savedInstanceState){
MyClass.contextShared = this;
}
so, and your code:
mDbHelper = new NotesDbAdapter(MyClass.contextShared);
mDbHelper.open();
On 14 dez, 16:54, Tobiah <[email protected]> wrote:
> I'm making a database wrapper from the Notepad example to fit my own database.
> I decided that I'd have a generic 'Row' class that I'd subclass for each
> table in the database. It would be responsible for setting and getting
> and syncing data between the app and the database.
>
> So, in the Notepad example, the NoteEdit class does this:
>
> mDbHelper = new NotesDbAdapter(this);
> mDbHelper.open();
>
> But the NoteEdit class extends Activity. I don't see that
> my Row class should extend Activity. Would it matter? If it
> does, can I just extend Activity even though the Row class
> will never be called as one?
>
> Thanks,
>
> Toby
--
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