mercredi 22 avril 2015

How to access sqlite database from the service class

I am fairly new to Android, and I am having some confusion on how to perform a certain process, and I would really appreciate is someone can help me out.

I have created a sqlitedatabase in an activity, and passing some data into the database. I am also starting a service in the same activity, which uses the data from the sqlite database which I created in this activity. I am starting the service in the following way.

 Intent intents = new Intent (SendActivity.this,ServiceClass.class);
    startService(intents);

Now I am confused how to access the database I created in this activity in the service class. I created the database like this

SqliteController db = new SqliteController(this);
    db.addGreetings(new Greetings(dt,txtPhoneNo,t,tm));

Aucun commentaire:

Enregistrer un commentaire