Save variables in a local file.txt

You must Login before you can answer or comment on any questions.

My situation Application type : mobile Titanium SDK : 2.1.1 Platform & version : iOS 5.1 Device : iOS simulator Host Operating System : mountain lion Titanium Studio : the last

I must create a shopping list. in a tab there is a textfield that allows you to add various items to buy. every time you add an item I can save it to a local file, because in another tab you can choose whether to load an old list or create a new list. if you load an old list I can get a file from which to retrieve data. how could I do? And is possible to use a local file.txt?

1 Answer

Accepted Answer

There are a number of data storage solutions build into Titanium.

You can use Ti.Filesystem to save data to a text file.

You can use Ti.App.Properties to save the data

You can use Ti.Database to save the data to an sqlite table.

— answered 10 months ago by Stephen Feather
answer permalink
9 Comments
  • The question I'd ask is what do you do with the text file? Will it only be used in app as a datastore? Do you plan on emailing it as an attachment?

    If you are only using it in app and you have an understanding of databases, I'd look at using sqlite.

    If however, its only in-app, and you don't have a database background, use properties.

    If its one giant string from a textfield, then you save it as a string (Ti.App.Properties.setString())

    — commented 10 months ago by Stephen Feather

  • the text file I would need to retrieve the previously saved data once the app is closed by the user. when the user restarts the application, with a special button "upload list" must be able to retrieve the list created earlier

    — commented 10 months ago by nicolò monili

  • virtually the user at home you create the list .. closes the app. goes to the store and reopen the app, press on "upload list" and must be able to view the list of items created at home

    — commented 10 months ago by nicolò monili

  • Show 6 more comments

Your Answer

Think you can help? Login to answer this question!