우리는 tidesdk 응용 프로그램에서 로컬 파일 시스템에 액세스 할 수 있습니다.
다음 코드를 참조하십시오.
var contents;
var file= 'test.txt';
var Dir = Ti.Filesystem.getUserDirectory();
var readfi= Ti.Filesystem.getFile(Dir, file);
if (readfi.exists())
{
var Stream = Ti.Filesystem.getFileStream(readFi);
Stream.open(Ti.Filesystem.MODE_READ);
contents =Stream.read();
alert(contents);
Stream.close();
}
위의 코드는 텍스트 파일을 읽고 내용을 경고합니다. tidesdk 파일 시스템을 알고 싶으시면 here을 방문하십시오.
다음 코드는 기본 브라우저에서 지정된 URL을 엽니 다.
Ti.Platform.openURL('http://stackoverflow.com');
다음 코드는 시스템의 기본 프로그램에서 특정 응용 프로그램이나 파일을 엽니 다.
Ti.Platform.openApplication('C:/Documents and Settings/Thavamani00/Desktop/readme.txt');
Ti.Platform.openApplication('C:/Documents and Settings/Thavamani00/Desktop/cart15.png');
위의 코드는 메모장에서 텍스트 파일을 표시하고 mircosoft 사진 관리자에서 이미지를 표시합니다.
me.i에서 잘 작동합니다. 필요한 답변이 필요합니다.
귀하의 솔루션은 파일 내용을 읽고 보여줍니다. 필요한 것은 파일 링크를 클릭하는 것입니다. 연결된 응용 프로그램에서 열 수 있습니다. 예를 들어, pdf 파일 링크를 클릭하면 adobe acrobat reader, 메모장이있는 텍스트 파일, Firefox 브라우저가있는 html 파일 등이 열립니다. – sparrow
참새 님의 possible.i이 (가) 내 게시물을 편집하면 해결할 수 있습니다. 너의 문제. – Thavamani
네, 멋지게 작동했습니다. – sparrow