Displaying a changing loop of pictures in a dialog?
<p>I'm not having much success doing this the way I thought would work so I'll ask the experts.</p>

<p>I have an ArrayList of ten URLs linking to images. I want to display the first URL for 2 seconds, then get the second URL and do the same until the end. </p>

<p>Here is what I have so far, I think perhaps I'm not going about it in the best way with a dialog in postExecute?:</p>

<pre><code> private class LiveView extends AsyncTask&lt;String, Integer, ArrayList&lt;String&gt;&gt; {
        ProgressDialog dialog;
        private volatile boolean running = true;

        @Override
        protected void onPreExecute() {
             dialog = ProgressDialog.show(
                        myView.this,
                        "Working",
                        "Info message . . .",
                        true,
                        true,
                        new DialogInterface.OnCancelListener(){

                            public void onCancel(DialogInterface dialog) {
                                cancel(true);                           
                            }
                        }
                );
            }

        @Override
        protected void onCancelled() {
              running = false;
        }

        @Override
        protected ArrayList&lt;String&gt; doInBackground(String... passed) {



            while (running) {

            //removed the code here that sends the request to to make this shorter the server but it works fine
            return responseFromServer.arrayListofURLs;           //list or URLs 

            }
            return null;
        }

        @Override
        protected void onPostExecute(ArrayList&lt;String&gt; listURLs) {      
            dialog.cancel();

            Dialog liveView = new Dialog(myView.this, R.style.Dialog);
            liveView.setContentView(R.layout.liveview_dialogue);
            TextView title = (TextView)liveView.findViewById(R.id.liveViewTitle);           
            Button button = (Button) liveView.findViewById(R.id.liveViewButton);
            ImageView trackImage = (ImageView)liveView.findViewById(R.id.liveViewImage);

            //I want to loop through the ten images here? 

            button.setOnClickListener(new OnClickListener() {

                public void onClick(View v) {

                }
            });
            liveView.show();



        }

    }
</code></pre>
