Friday, October 5, 2012

[android-developers] Custom array adapter issue

Hello.

I have very strange issue with getView -method in custom implementation of the adapter view - convertView argument doesn't return a proper view. From time to time it works well and I'm able to grab, for instance, ImageView with findviewbyid -method, but sometimes it returns a wrong view and when I'm trying to grab an ImageView it findviewbyid retunrs null. Is it a kind of library bug or something is really wrong with my code bellow? Thank you in advance for answers.

        @Override
public View getView(int position, View convertView, ViewGroup parent)
{
View view = convertView;
if(view == null)
{
LayoutInflater inflater = 
(LayoutInflater)this.context.getSystemService
(Context.LAYOUT_INFLATER_SERVICE);
view = inflater.inflate(R.layout.news_headlines_left, null);
        
}
               ImageView imgView = (ImageView)view.findViewById(R.id.newsPhotoLeft);
                      .
                      .
                      .
}

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate