Received: by 10.236.138.232 with SMTP id a68mr6145836yhj.28.1349440325790; Fri, 05 Oct 2012 05:32:05 -0700 (PDT) X-BeenThere: android-developers@googlegroups.com Received: by 10.236.154.232 with SMTP id h68ls5713934yhk.2.gmail; Fri, 05 Oct 2012 05:29:31 -0700 (PDT) Received: by 10.236.118.82 with SMTP id k58mr1011773yhh.1.1349440171638; Fri, 05 Oct 2012 05:29:31 -0700 (PDT) Date: Fri, 5 Oct 2012 05:29:30 -0700 (PDT) From: NikDmit To: android-developers@googlegroups.com Message-Id: <91f123b0-231d-46ea-a213-2c16d8053946@googlegroups.com> Subject: Custom array adapter issue MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_1010_15506563.1349440170682" ------=_Part_1010_15506563.1349440170682 Content-Type: multipart/alternative; boundary="----=_Part_1011_1534007.1349440170682" ------=_Part_1011_1534007.1349440170682 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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); . . . } ------=_Part_1011_1534007.1349440170682 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hello.

I have very strange issue with getView -method in= custom implementation of the adapter view - convertView argument doesn't r= eturn 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 retu= nrs null. Is it a kind of library bug or something is really wrong with my = code bellow? Thank you in advance for answers.

        @Override
=09public View getView(int position,= View convertView, ViewGroup parent)
=09{
=09=09View view =3D convertVie= w;
=09= =09
=09=09if(view =3D=3D null)
=09=09{
=09=09=09LayoutInflater inflater= =3D 
=09=09=09=09=09(LayoutInflater)this.context.getSystemService
=09=09=09=09= =09(Context.LAYOUT_INFLATER_SERVICE);
=09=09=09=09=09
=09=09=09view = =3D inflater.inflate(R.layout.news_headlines_left, null);
  =       
=09=09}
      &n= bsp;        ImageView imgView =3D (ImageView)view.findV= iewById(R.id.newsPhotoLeft);
        &nbs= p;             .
    &nbs= p;                 .
&nbs= p;                     .<= /div>
}
------=_Part_1011_1534007.1349440170682-- ------=_Part_1010_15506563.1349440170682--