[Object TIBlob] Response of .toString()
I'm sorry but i've been trying to make sense of this
var templatedata = t.read();
var templatestr = templatedata.toString();
var alertDialog = Titanium.UI.createAlertDialog({
title: 'Hello',
message: templatestr, (or templatestr.toString(),doesn't matter )
buttonNames: ['OK','Doh!']
});
alertDialog.show();
All the alert shows is [Object TIBlob], Shouldn't i be getting the data from the file? preferably in a string
Sorry about this I come from a mainly PHP server life, so typed variables phase me a little bit, brings me back to my high school classes :S
1 Answer
-
Accepted Answer
You should do it, with .text :
var f = Titanium.Filesystem.getFile(Titanium.Filesystem.resourcesDirectory, 'text.txt'); var templatedata = f.read(); var alertDialog = Titanium.UI.createAlertDialog({ title: 'Hello', message: templatedata.text, buttonNames: ['OK','Doh!'] }); alertDialog.show();