Error in imageloader in getView method

Eleni Tzag

I want to parse images from an xml using image loader but in the getView() method i get this error:

java.lang.IllegalArgumentException: view must not be null

this is my getView() method:

 final ArrayAdapter<RssItem> adapter = new ArrayAdapter<RssItem>(getActivity(),R.layout.row_site, R.id.nameTxt, result){
            public View getView(int position, View convertView, ViewGroup parent) {

                View view = super.getView(position, convertView, parent);

                ImageView left = (ImageView)getActivity().findViewById(R.id.img);
             String bit = result.get(position).getThumb();
                   //     Picasso.with(getActivity()).load(bit).into(left);

             DisplayImageOptions defaultOptions = new DisplayImageOptions.Builder()
                        .cacheOnDisc(true).cacheInMemory(true)
                        .imageScaleType(ImageScaleType.EXACTLY)
                        .displayer(new FadeInBitmapDisplayer(300)).build();

                ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(
                        getActivity().getApplicationContext())
                        .defaultDisplayImageOptions(defaultOptions)
                        .memoryCache(new WeakMemoryCache())
                        .discCacheSize(100 * 1024 * 1024).build();

                ImageLoader.getInstance().init(config);


                 imageLoader = ImageLoader.getInstance();
                DisplayImageOptions options = new DisplayImageOptions.Builder().cacheInMemory(true)
                        .cacheOnDisc(true).resetViewBeforeLoading(true)
                        .build();
                //imageView.setImageAlpha(120);
                //imageView.setColorFilter(Color.BLUE, PorterDuff.Mode.LIGHTEN);

                imageLoader.displayImage(result.get(position).getThumb(), left, defaultOptions);


                return view;
            }

        };

        setListAdapter(adapter);
        ListView list = getListView();
Akash Moradiya

try like this,

final ArrayAdapter<RssItem> adapter = new ArrayAdapter<RssItem>(getActivity(),R.layout.row_site, R.id.nameTxt, result){
            public View getView(int position, View convertView, ViewGroup parent) {

                LayoutInflater inflater = LayoutInflater.from(getActivity());
                convertView = inflater.inflate(R.layout.row_site, null, false);

                ImageView left = (ImageView) convertView.findViewById(R.id.img);
             String bit = result.get(position).getThumb();
                   //     Picasso.with(getActivity()).load(bit).into(left);

             DisplayImageOptions defaultOptions = new DisplayImageOptions.Builder()
                        .cacheOnDisc(true).cacheInMemory(true)
                        .imageScaleType(ImageScaleType.EXACTLY)
                        .displayer(new FadeInBitmapDisplayer(300)).build();

                ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(
                        getActivity().getApplicationContext())
                        .defaultDisplayImageOptions(defaultOptions)
                        .memoryCache(new WeakMemoryCache())
                        .discCacheSize(100 * 1024 * 1024).build();

                ImageLoader.getInstance().init(config);


                 imageLoader = ImageLoader.getInstance();
                DisplayImageOptions options = new DisplayImageOptions.Builder().cacheInMemory(true)
                        .cacheOnDisc(true).resetViewBeforeLoading(true)
                        .build();
                //imageView.setImageAlpha(120);
                //imageView.setColorFilter(Color.BLUE, PorterDuff.Mode.LIGHTEN);

                imageLoader.displayImage(result.get(position).getThumb(), left, defaultOptions);


                return convertView;
            }

        };

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

getView() method CHANGE listview items positions

분류에서Dev

Not able to Start Intent in TextView (programmatically created) inside the getView method of Adapter

분류에서Dev

How to use ImageLoader of Volley Library?

분류에서Dev

Fixing a method and parameter error

분류에서Dev

Error:The method is not aplicable for the arguments

분류에서Dev

Method with if statement with syntax error

분류에서Dev

getView not called on baseAdapter class

분류에서Dev

Android BaseAdapter getView

분류에서Dev

Displaying notification with external image link using ImageLoader

분류에서Dev

Why does the error method return an error?

분류에서Dev

No Method Error // Helper // Rails 3

분류에서Dev

Switch on enum method thread error

분류에서Dev

undefined method error in main:Object

분류에서Dev

Error on an asynchronous play method with reactivemongo

분류에서Dev

Unicorn undefined method error in production

분류에서Dev

Schema Error, 'has no method save'

분류에서Dev

Error using AutoMapper with asynchronous method

분류에서Dev

ArrayAdapter의 getView 및 AndroidAnnotations

분류에서Dev

Android 조각 getView ()는

분류에서Dev

ArrayAdater getView "캐싱"convertView

분류에서Dev

On Click issue with ViewHolder pattern but not with getView

분류에서Dev

Pointer on method in a tuple causes an error when calling the method through the tuple

분류에서Dev

Ballerina: mysterious "method is too large" error

분류에서Dev

Rails Rich Associations - undefined method error

분류에서Dev

Rails 3.2.1 - jQuery tokenInput "no method" error

분류에서Dev

Scala error implementing abstract method with type parameter

분류에서Dev

Class Error - An object reference is required for the method

분류에서Dev

rake db : migrate name error undefined method

분류에서Dev

rspec MissingTemplate error on :format => :json method

Related 관련 기사

  1. 1

    getView() method CHANGE listview items positions

  2. 2

    Not able to Start Intent in TextView (programmatically created) inside the getView method of Adapter

  3. 3

    How to use ImageLoader of Volley Library?

  4. 4

    Fixing a method and parameter error

  5. 5

    Error:The method is not aplicable for the arguments

  6. 6

    Method with if statement with syntax error

  7. 7

    getView not called on baseAdapter class

  8. 8

    Android BaseAdapter getView

  9. 9

    Displaying notification with external image link using ImageLoader

  10. 10

    Why does the error method return an error?

  11. 11

    No Method Error // Helper // Rails 3

  12. 12

    Switch on enum method thread error

  13. 13

    undefined method error in main:Object

  14. 14

    Error on an asynchronous play method with reactivemongo

  15. 15

    Unicorn undefined method error in production

  16. 16

    Schema Error, 'has no method save'

  17. 17

    Error using AutoMapper with asynchronous method

  18. 18

    ArrayAdapter의 getView 및 AndroidAnnotations

  19. 19

    Android 조각 getView ()는

  20. 20

    ArrayAdater getView "캐싱"convertView

  21. 21

    On Click issue with ViewHolder pattern but not with getView

  22. 22

    Pointer on method in a tuple causes an error when calling the method through the tuple

  23. 23

    Ballerina: mysterious "method is too large" error

  24. 24

    Rails Rich Associations - undefined method error

  25. 25

    Rails 3.2.1 - jQuery tokenInput "no method" error

  26. 26

    Scala error implementing abstract method with type parameter

  27. 27

    Class Error - An object reference is required for the method

  28. 28

    rake db : migrate name error undefined method

  29. 29

    rspec MissingTemplate error on :format => :json method

뜨겁다태그

보관