Re: [android-developers] Re: problem creating sqllite dabase
13.04.2011 19:44, ABSOLUT пишет:
> One newbie question, If I would like that the "SQLiteDatabase db"
> could use in other functions, how does I initialize in the OnCreate?
class MyActivity {
// Declare the variables in the class, outside any method
// This way they are accessible to all methods in the class
base baseDatos;
SQLiteDatabase db;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// This sets the variables declared above, but not too early
baseDatos = new base(this,"programacion",null,1);
db = baseDatos.getWritableDatabase();
}
private void doSomething() {
// You can access "baseDatos" and "db" here as needed
}
}
--
Kostya Vasilyev -- http://kmansoft.wordpress.com
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home