【问题标题】:Titanium download and save a file locally and show it in an ImageViewTitanium 下载并在本地保存文件并在 ImageView 中显示
【发布时间】:2014-09-19 09:13:41
【问题描述】:

我想下载一个文件(公共 URL)并将其保存到我的应用程序目录

Titanium.Filesystem.applicationDataDirectory

现在,如果我想在 ImageView 中显示该图像,我将使用什么路径?

【问题讨论】:

    标签: android titanium titanium-alloy


    【解决方案1】:

    试试这个代码,

     var photoFile = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, <Your Image Name with .png or .jpg>);
    
        var blobOfImage = photoFile.read();
    
                    var imageView = Titanium.UI.createImageView({
                        image : blobOfImage,
                        width : 'auto',
                        height : 'auto'
                    });
    

    我认为这对您有帮助。

    【讨论】:

    • 谢谢!试一试。
    猜你喜欢
    • 1970-01-01
    • 2012-02-21
    • 1970-01-01
    • 2019-02-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-02-19
    • 1970-01-01
    相关资源
    最近更新 更多