2

I have a application that has a simple database that stores text and i want to use the same database to store text from another activity, is there any way i use the same database on tow activities. i am using the database from the website http://www.tutorialspoint.com/android/android_sqlite_database.htm

1
  • Ofcourse it is possible. You can even share datababase with another applications. Commented Jul 15, 2014 at 18:24

2 Answers 2

2

You need to create instance DBHelper in your other activity, and call the method insertContact. Equals existing in example activity.

Sign up to request clarification or add additional context in comments.

Comments

1

Yeah, use it the same way you would in your first activity - you open it the same way, and the CRUD operations should be in the same Helper class, so you call them the same way.

But do yourself a favour, and use a library like https://github.com/jgilfelt/android-sqlite-asset-helper to simplify the process for you.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.