I can not understand everywhere they write that this is because of getView . But in my case, I do not take texts or images from the Internet or from the Sqlite database, the data is sent ready to the adapter. But anyway, every time it pops up and the listview jumps up and down.

Here is the adapter itself:

 public class RubricsResultAdapter extends ArrayAdapter { private List<VacancyModel> rubricsResutList; private int resource; private LayoutInflater inflater; Context context; int selectedStr; public RubricsResultAdapter(Context context, int resource, List<VacancyModel> objects) { super(context, resource, objects); rubricsResutList = objects; this.resource = resource; this.context = context; inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); } //Finding textViews and inserting data into them @Override public View getView(final int position, View convertView, ViewGroup parent) { ViewHolder holder; if (convertView == null) { holder = new ViewHolder(); // holder.checkBox.setChecked(isViewed.get(position)); convertView = inflater.inflate(resource, null); holder.tvProfession = (TextView) convertView.findViewById(id.tvProfessionRub); holder.tvProfile = (TextView) convertView.findViewById(id.tvProfileNameRub); holder.Salary = (TextView) convertView.findViewById(id.tvSalaryRub); holder.tvPostCr = (TextView) convertView.findViewById(id.tvPostCrRub); holder.logo = (ImageView) convertView.findViewById(id.ivVacSourceRub); holder.checkBox = (CheckBox) convertView.findViewById(id.cbxRub); holder.vacancyViewed = (LinearLayout) convertView.findViewById(id.viewedLayoutRub); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); holder.checkBox.setOnCheckedChangeListener(null);//Due to this line, the star is not changing after scrolling. // holder.checkBox.setChecked(isViewed.get(position)) } holder.tvProfession.setText(rubricsResutList.get(position).getProfession()); holder.tvProfile.setText(rubricsResutList.get(position).getProfile()); holder.Salary.setText(rubricsResutList.get(position).getSalary()); holder.tvPostCr.setText(rubricsResutList.get(position).getDate()); String sourceName = rubricsResutList.get(position).getSiteAddress(); switch (sourceName) { case JSONKeyNames.KEY_HH: holder.logo.setImageResource(R.drawable.logo_hh); break; case JSONKeyNames.KEY_DIESEL: holder.logo.setImageResource(R.drawable.logo_diesell); break; case JSONKeyNames.KEY_DOSKA: holder.logo.setImageResource(R.drawable.logo_doska); break; case JSONKeyNames.KEY_24: holder.logo.setImageResource(R.drawable.logo_twenty_four); break; case JSONKeyNames.KEY_GAZETA: holder.logo.setImageResource(R.drawable.logo_gazeta); break; } return convertView; } static class ViewHolder { private TextView tvProfession; private TextView tvProfile; private TextView Salary; private TextView tvPostCr; private CheckBox checkBox; private LinearLayout vacancyViewed; private ImageView logo; } } 

Here is a fragment where the adapter is called:

 public class RubricsResultFragment extends Fragment { RubricsResultAdapter adapter; public static List<VacancyModel> rubricsResultList; public static List<VacancyModel> subRubricsResultList; ListView listView; SwipyRefreshLayout swipyRefreshLayout; String expandAdapterText; public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.rubics_result_layout, container, false); //creating listView for vacancies listView = (ListView) rootView.findViewById(R.id.lvRubricsResultFragment); adapter = new RubricsResultAdapter(getContext(), R.layout.rubrics_result_row, rubricsResultList); listView.setAdapter(adapter); return rootView; } } 

Error: The application may be doing too much work on its main thread. 09-15 15:19:04.511 293-297/system_process D/dalvikvm: GC_CONCURRENT freed 632K, 17% free 10899K/13063K, paused 1ms+0ms, total 19ms The application may be doing too much work on its main thread. 09-15 15:19:04.511 293-297/system_process D/dalvikvm: GC_CONCURRENT freed 632K, 17% free 10899K/13063K, paused 1ms+0ms, total 19ms

Question: In my opinion everything is correct, but why does this error come out and how to fix it?

  • can a large text in one of TextView? - Vladyslav Matviienko
  • one
    As an optimization, you can not call rubricsResutList.get (position) each time, but initialize the object and take the required fields from it - s_klepcha
  • @metalurgus, no, everywhere is the same - DevOma
  • @s_klepcha, I understand the logic, but how do you mean? - DevOma
  • I asked if the text was not the same in them, but how many. Equally many, or equally small? - Vladyslav Matviienko

0