Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/189.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 如何在后台生成我的缩略图?_Android - Fatal编程技术网

Android 如何在后台生成我的缩略图?

Android 如何在后台生成我的缩略图?,android,Android,我有一个ListView和一个SimpleCursorAdapter。 我的SimpleCursorAdapter代码如下所示: private void listenAdapterErstellen() { adapter = new SimpleCursorAdapter(this, R.layout.my_listlayout, MainController.getInstance().getMyCursor(db), new S

我有一个
ListView
和一个
SimpleCursorAdapter
。 我的
SimpleCursorAdapter
代码如下所示:

private void listenAdapterErstellen()
{
    adapter = new SimpleCursorAdapter(this, R.layout.my_listlayout, 
            MainController.getInstance().getMyCursor(db), 
            new String[] {"Foo", "Test"}, 
            new int[] {R.id.imageViewFoo, R.id.textViewTest}, 0);

    adapter2.setViewBinder(new ViewBinder() {
        public boolean setViewValue(View view, Cursor cursor, int columnIndex) {
            if (columnIndex == 1) {
                ImageView imageView = (ImageView) view;

                String Pic = cursor.getString(1);
                if (Pic != null) {
                    File file = new File(Pic);
                    if (file.exists()) {
                        imageView.setImageBitmap(MainController.getInstance().generateBitmap(Pic, SessionActivity.this));
                    }
                } else {
                    imageView.setImageResource(R.drawable.ic_launcher);
                }
                return true;
            }
            if (columnIndex == 2) {
                ...
            }

            return false;
        }
    });
}
问题是,生成小位图的my
MainController.getInstance().generateBitmap()
需要很多时间。因此,在加载列表之前需要一些时间


如何在后台为列表生成图像并立即显示列表,然后添加图片?

此库适用于本地或web中保存的图像:

此库适用于本地或web中保存的图像:

此库包含许多指向优秀源代码(github项目)的链接这可以成为高效位图和图像列表加载器的通用方法。我在一些媒体密集型/网络密集型项目中取得了非常好、高效的成果

这包含许多指向优秀源代码(github项目)的链接,这些链接可以成为高效位图和图像列表加载程序的通用方法。我在一些媒体密集型/网络密集型项目中取得了非常好、高效的成果

尝试链接中的线程。包含优秀的源代码示例我需要他们做的东西,但不是在互联网上的文件中,而是在设备上的文件中。无论如何,把这个作为一个答案,我会接受它尝试链接线程。包含优秀的源代码示例我需要他们做的东西,但不是在互联网上的文件中,而是在设备上的文件中。无论如何,把这个作为一个答案,我会接受它