我有一个钛加速器和安卓的问题。我想将互联网上的图像保存到我的SD卡中。我该怎么做呢?
var externalSrc = "http://example.com/image.jpg";
saveButton.addEventListener('click',function(e) {
//?!?
});任何帮助都会非常感谢,非常感谢。
发布于 2012-10-29 18:41:05
我还没有在Android上尝试过这个代码,但在iOS上运行得很好。
var c = Titanium.Network.createHTTPClient();
var f = Titanium.Filesystem.getFile(directory, filename); // Here is the path to save the file.
var url = '/url/to/image.jpeg';
c.onload = function() {
// File saved
};
c.ondatastream = function(e) {
// Progress value in e.progress;
};
c.onerror = function(e) {
// error
};
c.open('GET', url); // open the client
c.setFile(f);
c.send(); // send the datahttps://stackoverflow.com/questions/13105323
复制相似问题