我将Uri放到SD卡中的所选文件夹中(代码工作正常)。我想做的就是制作该文件夹中的图片幻灯片。请告诉我我必须遵循的步骤。任何指针都会非常有用。
现在我只能使用
显示一张图片BitmapFactory.decodeFile
然后将其传递给image.setImagebitmap
答案 0 :(得分:0)
尝试使用此代码..功能完美。
/** 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