java.lang.StackOverflowError: stack size 8MB while Enabling/Disabling TextView#setTextIsSelectable in ListView Adapter

后端 未结 4 1474
粉色の甜心
粉色の甜心 2021-02-15 17:48

I have an activity with ListView . Displaying the TextView in each list item. Switching the properties of selected position using these methods E

4条回答
  •  既然无缘
    2021-02-15 18:20

    The best way to find the error is use a lot of logcat in your code and find where the logcat is not showing. But you can try to change your code like this:

    1. delete the inflater = LayoutInflater.from(context); in MyAdapter constructor
    2. move it in getview method like this:

      if (convertView == null) {
          LayoutInflater inflater = ((Activity) context).getLayoutInflater();
          convertView=inflater.inflate(R.layout.selectable_text_layout, null,false);
      viewHolder = new ViewHolder(convertView); convertView.setTag(viewHolder); }

提交回复
热议问题