replace image in local folder with URL coming from web service [duplicate]
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.
精彩评论