Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Display a file in a view within a window

I want to display the contents of a file within a view from my current window. Does anyone know how to do this? It seems like it should be easy to do but I have not found the answer yet.

var win = Titanium.UI.currentWindow;

var view = Titanium.UI.createView({

— asked November 17th 2010 by David Dushok
  • iphone
  • view
  • window

1 Answer

  • David

    A good example of this is in the KitchenSink in the filesystem.js script, importantly the read() method of the Titanium.Filesystem.File object. In filesystem.js it outputs the contents of the file with the code:

    — answered November 17th 2010 by Paul Dowsett
    1 Comment
    • Thus, you would be able to output the content of the $PROJECT/Resources/text.txt file using:

      Ti.Filesystem.getFile(Ti.Filesystem.resourcesDirectory, 'text.txt').read().text

      — commented November 17th 2010 by Paul Dowsett
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.