dimanche 18 octobre 2015

How to store multiple application's user information on a database (Android SqlLite)

im making a simple shiftmanagement app.

The app's concept is very simple : when the user starts the shift he clicks on a "start" button,when he ends the shift he clicks again on a "end" button . Then he can to move To "ShiftPage" which represent all his shifts for this month.

I try to handle this with only one database and I think I am making mistake... What I did :I created a database(lets call it "ShiftsDatabase") which contain a single table ,in the table I stored all the shift's info (such as id,start Hour,End Hour,EnteryDate ,ExitDate ,etc....).

When I click on the "end" button , I Insert a new row into the "ShiftsDatabase" (which contain all the shift info),then when I move to the "ShiftPage" I get all the shifts information from the database and represent it in a listview.

Its Working For me, but I think beacuse I am using a single database("ShiftsDatabase"),if another user will use this app the database will not initialized for him ,and the result would be that he will insert his shifts into the database(with the existing information about my shifts),therefore, he would get from the database not only his shifts but mines too.

So my question is : how I can create a diffrent Database for a diffrent user that using the app?, or how I initialized the Database for every user , so that he will see only his shifts in the database ,but not other users shifts...

And if that approach isnot posiible what should I do in order to handle this ?

I know my wording is very confusing and I am sorry for my terrible grammer , but I hope you do understan me ....

Thank you !

Aucun commentaire:

Enregistrer un commentaire