Hi,
I posted 4 weeks ago about some similar problem, with no answer, but i think my problem is easier to fix right now.
I simply want to refresh views on my window, when i use a createImageView or a createWebView, it work on the first time, but impossible to refresh the content if it change.
Can everyone please help me to understand what's wrong with my code ?
var win = Titanium.UI.currentWindow; var onAir = Titanium.UI.createWebView({ top: 70, left: 125, backgroundColor:'transparent', scalesPageToFit: false, touchEnabled: false, url: 'http://ellebore.getmyip.com:81/Ellebore/Morceau.aspx' }); var pubImage = Titanium.UI.createImageView({ image: 'http://radio-ellebore.com/pubmobile.jpg', top: 235, backgroundColor:'transparent', height: 125, width: 250 }); win.addEventListener("open", function(){ win.remove(pubImage); win.add(pubImage); }); setInterval(function() { win.remove(onAir); win.add(onAir); }, 1000);- Application type : Mobile - Titanium SDK : 2.1.3. GA - Platform & version : iOS 6 - Device : iOS simulator, Androïd simulator, iPhone 4S - X-Code : Version 4.5.1 (4G1004) - Host Operating System : OSX 10.7.4 - Titanium Studio : Titanium Studio, build: 2.1.2.201208301612 (c) Copyright 2012 by Appcelerator, Inc. All rights reserved.
Build: jenkins-titanium-rcp-master-232 (origin/master) Date: 30 August 2012, 16:14:46
2 Answers
What are trying to say? you are simply removing and adding the same view.... you are not changing the url or the web view so how it is going to refresh..
setInterval(function() { win.remove(onAir); win.add(onAir); }, 1000);
Thanks for your answer,
Actually, i don't really know how to manage refresh action. That's why i'm posting here, the views that i'm trying to refresh are supposed to be the sames:
- For the image, it's the same URL, but we replace the source
- For the webview, it's a changing text (artist and song from stream) and I want it to refresh when the source change, that's why I was trying to remove and add the same view...
I don't know why the view doesn't change when the source change... Is there something like a local cache ?
Your Answer
Think you can help? Login to answer this question!