Hi guys,
I currentley have a webview that runs as a thread so that I can change
the url every 10 sec.
public class HtmlView extends Activity implements Runnable
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.html);
webview = (WebView) findViewById(R.id.HTML);
webview.getSettings().setJavaScriptEnabled(true);
Thread thread = new Thread(this);
thread.start();
}
public void run()
{
//Get the message
String msgUrl = getNextMessage();
//Set the message to the WebView
Bundle data = new Bundle();
Log.i("msgUrl", msgUrl);
data.putString("url", msgUrl);
UImsg = new Message();
UImsg.setData(data);
handler.sendMessage(UImsg);
handler.postDelayed(this, 10000);
}
private Handler handler = new Handler() {
public void handleMessage(Message msg)
{
//
webview.startAnimation(AnimationUtils.loadAnimation(webview.getContext(),
R.anim.fadeout));
Bundle b = msg.getData();
String url = b.getString("url");
webview.loadUrl(url);
webview.startAnimation(AnimationUtils.loadAnimation(webview.getContext(),
R.anim.fadein));
}
};
Is this the right way to do it? What I want to do is:
1. Fade the view out
2. Add a new url
3. Fade the view in
Ho do I get my fading to work as described above?
For now, this should run forever (I will implement a another thread
reading the SD memory searching for files that will change to a
different activity).
Best regards, Jake142
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en