安卓:添加时间戳的URL的WebView [英] Android: Add Timestamp to URL for WebView

查看:1590
本文介绍了安卓:添加时间戳的URL的WebView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先,我不是一个程序员,我老婆让我学会如何为Android程序,因为她要我做她的一些应用程序,以周围的房子使用。

For starters, I am not a programmer, my wife is making me learn how to program for Android because she wants me to make her some apps to use around the house.

我有一个加载JPG成的WebView窗口,一个基本的应用程序。我读了,为了帮助管理缓存是一个时间戳添加到URL是一个好主意。

I have a basic app that loads a JPG into a WebView window. I read that in order to help manage caching it's a good idea to add a timestamp to a URL.

我不知道如何添加时间戳到URL。

I am not sure how to add a Timestamp into the URL.

这是我现在:

mWebView.loadUrl("http://www.website.com/webviewimage.jpg"+"?123");

我计划时间戳取代?123,但我不知道如何键入此,我在code的开始有这个,所以希望,我想我中途有:

I plan to replace the "?123" with the Timestamp, but I'm not sure how to type this in. I have this in the beginning of my code so hopefully, I'm thinking I'm halfway there.:

import java.sql.Timestamp;

感谢你这么多的帮助。

干杯,

帕特

推荐答案

这将使以毫秒为单位的当前时间到您的网址的结尾。

This will put the current time in milliseconds on to the end of your URL.

mWebView.loadUrl("http://www.website.com/webviewimage.jpg?" + System.currentTimeMillis());

这篇关于安卓:添加时间戳的URL的WebView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆