在onCreate()方法中,有没有办法重新加载URL?我正在尝试每分钟重新加载网址
public class AAPActivity extends DroidGap
{
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
loadUrl("file:///android_asset/www/index.html");
task = new TimerTask(){
public void run() {
handler.post(new Runnable() {
public void run() {
// Here instead of loadURL, is there a way to reload?
loadUrl("file:///android_asset/www/index.html");
}
});
}};
t.schedule(task, 0, 10000);
}
}
谢谢
答案 0 :(得分:0)
由于它是Phonegap应用程序,您可能会使用javascript。我发现了这个:
<script type = "text/Javascript">
function refresh() {
window.location.reload(true);
tim = setTimeout("refresh()",60000); // refresh every minute
}
</script>
<{3>} http://www.codingforums.com/archive/index.php/t-157966.html。也许这有帮助;)