2012-11-08 38 views
1

我將在哪裏保存用戶稍後可以在Android上輕鬆訪問的文本文件?在Android上保存文本文件的位置以供用戶稍後訪問

我使用的Adobe AIR,這是一個重要的注意,它有一些預定義的文件路徑:

var fileLocation:String = "my_file.txt"; 
file = File.applicationStorageDirectory.resolvePath(fileLocation); 
file = File.applicationDirectory.resolvePath(fileLocation); 
file = File.desktopDirectory.resolvePath(fileLocation); 
file = File.documentsDirectory.resolvePath(fileLocation); 
file = File.userDirectory.resolvePath(fileLocation); 
file = new File(fileLocation); 

注:這裏有一個相關的問題[1],但它採用的是Android特定的API 。如果這是最好的位置,那很好,但是AIR所轉換的就是我正在尋找的東西(就像上面代碼中的等效位置)。

假設其中一條路徑指向適當或可接受的位置。你會將該文件放在一個子目錄中嗎?

[1] Android - Where to save text files to?

回答

1

File.userDirectory和File.documentsDirectory都保存到SD卡的根目錄下,這可能是最好的起點。您可能需要添加與您的應用程序同名的另一個目錄,以幫助用戶找到它。

相關問題