0

The following is my layout:

<FrameLayout
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

    <ProgressBar
        style="?android:attr/progressBarStyleLarge"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center" /> 

    <ImageView
    android:id="@+id/imageView1"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"/>           
</FrameLayout>

I'm trying to downlaod an image given the url link and then show the image on the ImageView. Before the image is ready, the ProgressBar shows on the ImageView. Till so far, my code can download the image and show it on the ImageView. There is an obvious delay before the image shows up since downloading takes time. Can anyone give me some suggestions? I'm new to android and this is not a homework.

Fihop
  • 3,127
  • 9
  • 42
  • 65

1 Answers1

0

You need to use AsyncTask... Here is a good tutorial on it:

http://www.androidhive.info/2012/04/android-downloading-file-by-showing-progress-bar/

J_Sizzle
  • 600
  • 1
  • 4
  • 12