dimanche 1 février 2015

Android SQLite how to save chat messages

I want to save a chat with a lot of messages in a database. But I dont know what will be the best practise for this.


My first idea was to create a column with all messages, but i think this will be very slow when there are over 1000 messages, because i have to get the string...split it to an array...get tha last 20 messages...or remove a message inside the array and make the array back to a string and update the database.


My second idea was to create for every user a new table with columns like "_id" and "message" and name the table like "chat_user_name" or "chat_group_name"


I think the second one will be the best practise, but i dont know if it is the correct way to do it so.


Hope somebody can help me!


Aucun commentaire:

Enregistrer un commentaire