Just to get it right: do you want to have one URI and insert a message and all its tags with one call to the ContentProvider insert? Right?
The problem is that you need to have all the values ββin the ContentValues ββobject. There is a reason for normalization in the database. However, this may be feasible. For tags, this should be easy. Just use one String for all tags. For example, "android, ios, bada, wp7" and parse this line in the insert method.
You can also use a naming convention plus an integer. And while there is tag1, tag2, ... tagX, you should read these values ββfrom your ContentProvider insertion method.
Nothing is elegant but will work.
In this case, bulkInsert or applyBatch does not have a place in your code. They only come into the game if you want to use several calls for your ContentProvider at once and during one transaction.
But I think the best solution would be to actually use multiple operations, as described by biegleux.
source share