2011-11-08 12 views
2

私はSDカードの中の選択されたフォルダにUriを持っています。私がしたいのは、そのフォルダにある写真のスライドショーを作ることだけです。親切にも、私が従わなければならないステップを教えてください。どんなポインタでも大変役に立ちます。SDカードのフォルダ内にある写真のスライドショーを開始する方法

今私は

BitmapFactory.decodeFile 

を使用して、単一の画像を表示することができるよ、その後image.setImagebitmap

答えて

0

にこのcode..itが完全に働いてみことを渡します。

/** For Images Slidshow. */ 
    public int currentimageindex=0; 
     Timer timer; 
     TimerTask task; 
     ImageView slidingimage; 

     int[] IMAGE_IDS = {R.drawable.mic, R.drawable.mic5, R.drawable.mic6, 
       R.drawable.mice7}; 

     //code of slideshow start from here 

     final Handler mHandler = new Handler(); 

     // Create runnable for posting 
     final Runnable mUpdateResults = new Runnable() { 
      public void run() { 

       AnimateandSlideShow(); 

      } 
     }; 

     int delay = 1000; // delay for 1 sec. 

     int period = 8000; // repeat every 4 sec. 

     Timer timer = new Timer(); 

     timer.scheduleAtFixedRate(new TimerTask() { 

     public void run() { 

      mHandler.post(mUpdateResults); 

     } 

     }, delay, period); 

    } 


     private void AnimateandSlideShow() { 

     slidingimage = (ImageView)findViewById(R.id.ImageView_id); 
     slidingimage.setImageResource(IMAGE_IDS[currentimageindex%IMAGE_IDS.length]); 

     currentimageindex++; 

     } 
//code of slideshow ends here 
関連する問題