title: Showing continuous image in Android
body: <p>I want to show about 30 photos in one second,so they will display like a video.</p>
  
  <p>I use Android ImageView in a while(TRUE) loop, but the ImageView not change as I expected.</p>
  
  <p>The ImageView change the picture for about a per second, so wonder if there is another way to </p>
  
  <p>show my photos?</p>
  
  <p>The photos was transferred from a camera using Udp,and I first need to store in a buffer and </p>
  
  <p>than display.</p>
  
  <p>The above part cause a delay in the ImageView.</p>
  
  <p>Part of the code is like this</p>
  
  <pre><code>  public void receiveVideoRawData() throws IOException{
          socket_video = new DatagramSocket();
          byte[] buf_rcv = new byte[153600];
          DatagramPacket rawData = new DatagramPacket(buf_rcv, buf_rcv.length);
          Bitmap  image = null;
          socket_video.receive(rawData);//receive a raw data
          image = readMyRawData.readUINT_RGBImage(buf_rcv);//decode the raw data
          ByteArrayOutputStream blob = new ByteArrayOutputStream();
          Bitmap pBitmap = image ;
          pBitmap.compress(Bitmap.CompressFormat.JPEG, 1, blob);
          byte[] bitmapdata = blob.toByteArray();
          ardrone_Frame = BitmapFactory.decodeByteArray(bitmapdata , 0, bitmapdata.length);
        }
  </code></pre>
  
  <p>display part</p>
  
  <pre><code>  Thread thread=new Thread  (new Runnable() {
       Message message;
      String obj="run";
      int i;
      long start;
      @Override
      public void run() {   
          // TODO Auto-generated method stub
           Log.e("///enter thread ","THREAD");
      while(true){     
          try { 
              Log.e("enter_video_thread","enter_video_thread");
              receiveVideoRawData();
              Log.e("///receiveVideoRawData ","receiveVideoRawData");
              message = handler.obtainMessage(1,obj);
                      handler.sendMessage(message);
              }
  
          } catch (IOException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          }   
      }
  }
  
  });
  public Handler handler = new Handler(){ 
      @Override
      public void handleMessage(Message msg) {
              super.handleMessage(msg);
              String MsgString = (String)msg.obj;
              if (MsgString.equals("run"))
              {         Log.e("///enter handler ","HANDLER");                                           
                            Toast.makeText(ArDroneMain.this,"save image ",Toast.LENGTH_SHORT).show();
                            //Bitmap bitmap = BitmapFactory.decodeFile(Environment.getExternalStorageDirectory()+ "/ArdroneVideo.jpg");
                            myImageView.setImageBitmap(ardrone_Frame);    ///Show the image    
                            Toast.makeText(ArDroneMain.this,"show image",Toast.LENGTH_SHORT).show();
               }
  
      }
  };
  </code></pre>