How to read local text file in native mobile library built in Viz 8.3?

This thread was migrated from an old forum. It may contain information that are no longer valid. For further assistance, please post a new question or open a support ticket from the Customer Support portal.

I am following the documentation provided here: http://docs.kony.com/konylibrary/visualizer/viz_api_dev_guide/content/kony.io.file_functions.htm in order to read from text file.

I've placed the files at <WorkSpace>\<App>\resources\mobile\common\raw as mentioned here: http://docs.kony.com/konylibrary/visualizer/viz_api_dev_guide/content/inputoutput_api.htm

Hi @Penelope Seymouw​ ,

The example given in the following link should help you in reading a text file.

http://docs.kony.com/konylibrary/visualizer/viz_api_dev_guide/Default.htm#kony.io.file_functions.htm#readAsText

Hi @Luke Mvwtin​ ,

I have already tried using readAsText() function but the problem is, the step before that i.e.

var reading = new kony.io.File(myFileLoc).read();

reading is always null.

Hi ,

Are you using the following snippet to get the path of the file?

var myFileLoc=kony.io.FileSystem.getDataDirectoryPath()

Also check if you are getting any value in myFileLoc.

Yes I am. It's value is: /data/user/0/<app package name>/files

And I went to that folder using adb shell but I couldn't find the file I am trying to read although I have placed my file at <WorkSpace>\<App>\resources\mobile\common\raw as mentioned here: http://docs.kony.com/konylibrary/visualizer/viz_api_dev_guide/content/inputoutput_api.htm