Using java Syntax Highlighting
package com.example.Slideshow;
import java.util.Timer;
import java.util.TimerTask;
import android.app.Activity;
import android.graphics.drawable.Drawable;
import android.os.AsyncTask;
import android.os.Bundle;
public class slideshow extends Activity {
/** Called when the activity is first created. */
private long delayInMili = 3000;
private Timer mTimer;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
@Override
protected void onPause() {
super.onPause();
if (mTimer != null) {
mTimer.cancel();
mTimer.purge();
}
}
@Override
protected void onResume() {
super.onResume();
mTimer = new Timer();
mTimer.schedule(new TimerTask() {
@Override
public void run() {
new Downloader().execute("URL");
}
}, 0, delayInMili);
}
private class Downloader extends AsyncTask<String, Void, Drawable> {
@Override
protected Drawable doInBackground(String... URL) {
// Download picture
return null;
}
@Override
protected void onPostExecute(Drawable image) {
super.onPostExecute(image);
// Update the ImageView
}
}
}
Parsed in 0.035 seconds, using
GeSHi 1.0.8.4
To set your downloaded image to the ImageView you can create a Drawable by using Drawable.createFromStream and then set the Drawable to the ImageView with setImageDrawable. It was not clear from your post if you needed help with creating the rest of the app, so i wrote a short code snippet of how i would approach the problem.