Reputation: 5953
I want to know that which way is faster in performance between Intent.PutExtra
or SQLite query
.
ID, First Name, Last Name, Location, Phone Number
etc or
ID
of the object and in the 2nd activity I will make a query to the database.Upvotes: 2
Views: 573
Reputation: 1483
Generally speaking, message passing using Intent
s is going to be faster than any kind of disk I/O, which is what a SQL query would be doing inevitably. That's not to say that in all scenarios this will always be true, which is why doing some benchmarking yourself would be helpful, since it would show in your scenario and for your implementation which way works better.
If you only have a few items that need to be passed from one Activity
/Service
to another, using Intent
s for message passing works well. But for large amounts of data or for persistence across device boots, etc, databases are the way to go.
Upvotes: 2