Hashmap代码在 simpleadapter 数组运行但不能在 custom array adapter 中运行

下面的 Hashmap代码在 simpleadapter 数组中可以运行但是在自定义的 adapter 数组中不能运行,为什么呢?

我使用的 lazyLoading 类来加载图像。

public void onItemClick(AdapterView<?> parent, View view,
                    int position, long id) {


                HashMap<String, String> o = (HashMap<String, String>) list.getItemAtPosition(position);
                Toast.makeText(CustomizedListView.this, "ID '" + o.get("KEY_TITLE") + "' was clicked.", Toast.LENGTH_SHORT).show(); 

            }     

当点击显示的时候,程序就崩溃。
LogCAT:

threadid=1: thread exiting with uncaught exception (group=0x40ab0228)
 FATAL EXCEPTION: main
 java.lang.ClassCastException: java.lang.Integer cannot be cast to java.util.HashMap
    at com.example.androidhive.CustomizedListView$1.onItemClick(CustomizedListView.java:94)
    at android.widget.AdapterView.performItemClick(AdapterView.java:292)
    at android.widget.AbsListView.performItemClick(AbsListView.java:1077)
    at android.widget.AbsListView$PerformClick.run(AbsListView.java:2533)
    at android.widget.AbsListView$1.run(AbsListView.java:3198)
    at android.os.Handler.handleCallback(Handler.java:605)
    at android.os.Handler.dispatchMessage(Handler.java:92)
    at android.os.Looper.loop(Looper.java:154)
    at android.app.ActivityThread.main(ActivityThread.java:4945)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
    at dalvik.system.NativeStart.main(Native Method)

在自定义的 Adapter 中你是返回位置,而不是item

public Object getItem(int position) {
            return position;
        }

使用:

public Object getItem(int position) {
                return data.get(position);
            }

能改正你的问题。