java - Android - Gridview Lag -


I have seen more people with the same problem, and I have tried some proposed solutions but nothing worked away.

I have an image (and a small title below), which is stored in internal memory (initially they were stored in the SD card but then I changed it because I thought the error Can be solved).

I think I need to improve the efficiency of the getView () method Does anyone get an error due to this error?

  see public getView (see the status of int, seeviewview, ViewGroup parent) {see v = convertView; Image image; Textview name; If (V == zero) {v = inflater.inflate (R. Lit. Grid_itam, guardian, wrong); V.setTag (R. pitch, v.findViewById (R. p.)); V.setTag (rid.txt, v.findViewById (Rdtext)); } PIC = (ImageView) v.getTag (R.id.picture); Name = (TextView) v.getTag (R.id.text); Beer item = (beer) mill item (status); Picture.setImageBitmap (decodeScaledBitmapFromSdCard (item.photoPath, 150, 150)); Name.setText (item.name); Return vi; }  

Thank you in advance!

You should use View Holder Pattern

Public View GetView ( Integer position, seeviewview, viewgroup parent) {see v = convertView; DataHolder holder = Null; If (holder == faucet) {v = inflater.inflate (R. Lit. Grid_itm, guardian, wrong); Holder = New Dataholder (); Holder.name = (text view) v.findViewById (rttext); Holder Picture = (Image View) v.findViewById (R. pitch); } And {holder = (DataHolder) v.getTag (); } V.setTag (Holder) Holder. Image: SettlementBitmap (Decode ScaleBitMapFom SD Card (item.photo path, 150, 150)); Holder.name.setText (item.name); Return vi; } Static class dataholder {image image; Textview name; }

Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -