在android中,我们如何在运行时从sdcard中的特定文件夹中检索或复制图像到drawable文件夹。基本上,我想显示幻灯片一样,在给定的链接,但问题是,他们正在检索所有的图像从绘图文件夹,我想从一些sdcard文件夹检索。我是android的初学者,所以请帮助我。
here is the link :
http://www.edumobile.org/android/android-development/image-gallery-example-in-android/发布于 2013-02-14 15:36:37
对res/drawable文件夹中的资源进行编译和优化。请看一下http://www.linuxtopia.org/online_books/android/devguide/guide/topics/resources/android_resources-i18n_CreatingResources.html。
如果你想使用SD卡上的图像,你必须从一个文件中加载它们。简单的例子是:
Bitmap bitmap = BitmapFactory.decodeFile(imageFile.getAbsolutePath());
jpgView.setImageDrawable(bitmap);总之。可绘制文件夹以一种特殊的方式处理。
参数imageFile是类文件的对象。http://developer.android.com/reference/java/io/File.html
变量jpgView是类ImageView的一个实例。但这只是一个例子。http://developer.android.com/reference/android/widget/ImageView.html
就循环而言,您必须遍历文件夹中的文件。请查阅相关文档。
https://stackoverflow.com/questions/14869628
复制相似问题