Android 在使用SimpleCursorAdapter时,如何加快在listView中加载ImageView的速度?

Android 在使用SimpleCursorAdapter时,如何加快在listView中加载ImageView的速度?,android,listview,imageview,lazy-evaluation,Android,Listview,Imageview,Lazy Evaluation,嘿,我的问题是如何加快我的listView的加载速度…因为我有一个问题,它因为ImageView而变得非常懒惰。但是我怎样才能把照片加载到缓存中呢? 我正在使用简单的游标适配器从我的Sql数据库加载数据。这是我的密码: void populateListViewFromDB() { Cursor cursor = myDb.getAllRows(); // Allow activity to manage lifetime of the cursor. // DEPR

嘿,我的问题是如何加快我的listView的加载速度…因为我有一个问题,它因为ImageView而变得非常懒惰。但是我怎样才能把照片加载到缓存中呢? 我正在使用简单的游标适配器从我的Sql数据库加载数据。这是我的密码:

void populateListViewFromDB() {

    Cursor cursor = myDb.getAllRows();

    // Allow activity to manage lifetime of the cursor.
    // DEPRECATED! Runs on the UI thread, OK for small/short queries.
    getActivity().startManagingCursor(cursor);
    //if (cursor.moveToLast()) {
        //  do {
        // do what you need with the cursor here


    // Setup mapping from cursor to view fields:
    String[] fromFieldNames = new String[] 
            {DBAdapter.KEY_NAME,DBAdapter.KEY_PRICE,DBAdapter.KEY_LEVEL,DBAdapter.KEY_ART,DBAdapter.KEY_VALUETXT,DBAdapter.KEY_PIC };
    int[] toViewIDs = new int[]
            {R.id.tv_Shop_item1,     R.id.tv_Shop_Price_item1,R.id.tv_shop_Level_item1,R.id.tv_shop_use_item1,R.id.tv_shop_use_item2,R.id.IV_Shop_item1 };

    // Create adapter to may columns of the DB onto elemesnt in the UI.
    SimpleCursorAdapter myCursorAdapter = 
            new SimpleCursorAdapter(
                    getActivity().getApplicationContext(),      // Context
                    R.layout.item_shop, // Row layout template
                    cursor,                 // cursor (set of DB records to map)
                    fromFieldNames,         // DB Column names
                    toViewIDs               // View IDs to put information in
                    );

    // Set the adapter for the list view

    myList.setAdapter(myCursorAdapter);
     //  } while (cursor.moveToPrevious());
    //}
}
或者是否有其他方法将图片添加到ListView?因为我总是阅读其他问题如何在Chache中保护位图


谢谢你的帮助,也为我糟糕的英语感到抱歉。我来自德国

试试这个库。这是一个功能完善的图像加载库,支持缓存


你读过这个吗?基本上,在后台线程中加载图像并缓存它们,然后在需要时使用它们。这对我的代码有用吗?但是这些图片在我的可绘制文件夹中,这是一个问题,我如何将图片添加到我的ListView?你也可以使用库在可绘制文件夹中加载图片。