开发者

replace image in local folder with URL coming from web service [duplicate]

This question already has answers here: Closed 11 years ago.

Possible Duplicate:

android: webservice image replace with images in Local folder

How can I replace an image in local folder with the URL received from web service. Please provide me a sample code or a si开发者_C百科mple example.

Guide me in this issue.

Thanks in advance.

Regards


URL url="http://....";
 String FILENAME;
    InputStream input=new InputStream(url.openConnection()
    BufferedInputStream bis = new BufferedInputStream(input);
    fileDest=new File(FILENAME);

        if ( fileDest.exists() ){
            if ( ! fileDest.delete() )
                throw new Exception (
                        "impossible to delete "+ fileDest.getName());
        }
FileOutputStream fos = openFileOutput(FILENAME, Context.MODE_PRIVATE);
fos.write(bis.getBytes());
fos.close();

I guess you can start with this.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜