0

I have two service classes like Service A and Service B running simultaneously. The two services need SQLite data from a single table. When two queries are executed simultaneously, the application crashes when data is fetched from one table. Here is what I mean:

Service A
{
  db.getdata();
}

Service B
{
  db.getdata();
}

Is there any way to execute the same query simultaneously on a single table? If so, how?

3
  • show code you have written to fetch data as well as update your query with logs for crash Commented Sep 10, 2016 at 8:01
  • check here on how to avoid that -- stackoverflow.com/questions/19755142/… -- however i suspect your problem lies somewere else so add the code and error you see in the log cat Commented Sep 10, 2016 at 8:05
  • there is no logcat error for this crash.when app get crash app not closing. Commented Sep 10, 2016 at 8:18

1 Answer 1

1

To handle such errors, its best to use Content Providers,it handles such requests.

If you want to continue using sqlite, create a singleton for ur sqlite object and make calls synchronous

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

2 Comments

github.com/ikartiks/Capstone-project/blob/master/greVocab/src/… mark the answer as correct if you find the solution useful
This answer should be the accepted answer. Nice one!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.