Attempt to invoke virtual method On changing Listview item image

674 views Asked by At

I am not able to change Image on listview item when click on listview button

Logcat error

java.lang.NullPointerException: Attempt to invoke virtual method 'void android.widget.ImageView.setBackgroundResource(int)' on a null object reference 

Java code onclick

holder.txtnext.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
             try{

                  imageUrls=strimgview.get(pos).split("\\|\\|");
                  i=imageUrls.length;
                  if((i<=1))
                  {
                      i++;
                      ImageView imageView =(ImageView) v.findViewById(R.id.npTupleImage);
                      imageView.setBackgroundResource(R.drawable.logo);
                     // imageLoader.displayImage(imageUrls[i], imageView, options);

                //  Log.d("imageUrlnew ",imageUrls[i]);
                  Log.d("imageUrlnew ",i+"   "+imageUrls.length);

                  }

                 }
                 catch(Exception e)
                 {
                     Log.d("imageUrlnew ",e+"   "+imageUrls.length);
                 }

        }
    });

Please help me how can solve this issue

Thanks In Advance

0

There are 0 answers