Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class HomeListAdapter extends SimpleCursorAdapter {
- public HomeListAdapter (Context context, int layout, Cursor c,
- String[] from, int[] to) {
- super(context, layout, c, from, to);
- mImageLoader = new ImageDownloader(mResources,((BitmapDrawable)mResources.getDrawable(R.drawable.default_row_pic)).getBitmap(), 1);
- this.context = context;
- }
- Context context = null;
- ImageDownloader mImageLoader = null;
- @Override
- public void setViewImage(ImageView v, String value) {
- if(!value.equals("")){
- mImageLoader.download(value, (ImageView)v);
- }
- else {
- v.setImageResource(R.drawable.default_row_pic);
- }
- }
- }
- //using adapter
- String[] from = new String[] {DBAdapter.KEY_CATEGORY_NAME, DBAdapter.KEY_URL_PIC, DBAdapter.KEY_INTRO, DBAdapter.KEY_TITLE};
- int[] to = new int[] {R.id.cat, R.id.picture, R.id.intro, R.id.title};
- new HomeListAdapter(this, R.layout.article_row, c, from, to)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement