1

I created a gridview with a custom ArrayAdapter. Inside of the gridView is a couple of TextViews, an EditText and a Spinner. Everything was going fine until I added listeners to the Spinner and the EditText. Aside from the trouble of getting these to work (a lot of issues with the recycling) now it is lagging quite heavily. I read around and it seems that this is an inherent issue.

There is up to 16 items. Doing this manually in a Gridlayout or something would cause a ton of manual repeated work, which is why I went with a GridView and adapter. But the performance issues is a major problem.

So is there a way I can duplicate the functionality of a GridView without the issues that I am running into?

If someone thinks they can solve my performance issues with the current code I am happy to post. It is pretty standard ArrayAdapter using the viewholder pattern. Thanks

UPDATE: Ok, so I ended up just going with the RecyclerView using the pattern laid out in this accepted answer Saving EditText content in RecyclerView After some tweaking to my code I have gotten rid of the lag.

Community
  • 1
  • 1
Ephraim Schmitt
  • 227
  • 2
  • 16

2 Answers2

1

Why dont you use a RecyclerView? It is meant for situations where you need to do a large number of calls to repeated patterns like in your gridview. It is much more efficient than gridview/listview for complex layouts.

deefunkt
  • 331
  • 2
  • 12
  • I can't speak for OP, but I sometimes I just want a grid rather than a linear list. I've been looking for something to do this, and can't figure it out yet. – Matt Payne Dec 08 '20 at 15:17
0

You can try using TableLayout and see if it improves things. You can add all your rows as rows of TableLayout. TableLayout

greenrobo
  • 781
  • 1
  • 6
  • 9
  • It appears that the rows would have to be added manually. Is there a way to add the rows with something like an adapter? thanks. – Ephraim Schmitt Feb 17 '16 at 03:14