/** * 描述:获取存储实例. * * @param context the context * @return single instance of AbSqliteStorage */ public static AbSqliteStorage getInstance(Context context) { mContext = context; if (null == mSqliteStorage) { mSqliteStorage = new AbSqliteStorage(context); } // 用队列避免并发访问数据库问题 mAbTaskQueue = AbTaskQueue.getInstance(); return mSqliteStorage; }
public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mActivity = this.getActivity(); application = (MyApplication) mActivity.getApplication(); View view = inflater.inflate(R.layout.pull_list, null); mPhotoList.add( "http://img01.taobaocdn.com/bao/uploaded/i3/13215035600700175/T1C2mzXthaXXXXXXXX_!!0-item_pic.jpg_230x230.jpg"); mPhotoList.add( "http://img01.taobaocdn.com/bao/uploaded/i2/13215025617307680/T1AQqAXqpeXXXXXXXX_!!0-item_pic.jpg_230x230.jpg"); mPhotoList.add( "http://img01.taobaocdn.com/bao/uploaded/i1/13215035569460099/T16GuzXs0cXXXXXXXX_!!0-item_pic.jpg_230x230.jpg"); mPhotoList.add( "http://img01.taobaocdn.com/bao/uploaded/i2/13215023694438773/T1lImmXElhXXXXXXXX_!!0-item_pic.jpg_230x230.jpg"); mPhotoList.add( "http://img01.taobaocdn.com/bao/uploaded/i3/13215023521330093/T1BWuzXrhcXXXXXXXX_!!0-item_pic.jpg_230x230.jpg"); mPhotoList.add( "http://img01.taobaocdn.com/bao/uploaded/i4/13215035563144015/T1Q.eyXsldXXXXXXXX_!!0-item_pic.jpg_230x230.jpg"); mPhotoList.add( "http://img01.taobaocdn.com/bao/uploaded/i3/13215023749568975/T1UKWCXvpXXXXXXXXX_!!0-item_pic.jpg_230x230.jpg"); mAbTaskQueue = AbTaskQueue.getInstance(); // 获取ListView对象 mAbPullListView = (AbPullListView) view.findViewById(R.id.mListView); // ListView数据 list = new ArrayList<Map<String, Object>>(); // 使用自定义的Adapter myListViewAdapter = new ImageListAdapter( mActivity, list, R.layout.list_items, new String[] {"itemsIcon", "itemsTitle", "itemsText"}, new int[] {R.id.itemsIcon, R.id.itemsTitle, R.id.itemsText}); mAbPullListView.setAdapter(myListViewAdapter); // item被点击事件 mAbPullListView.setOnItemClickListener( new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) {} }); return view; }