-2

I'm new to everything, so have mercy.

So for my first app I wanted to do a simple scoreboard app for the upcoming world cup. I used a TableLayout and put TextViews in each row (for example Pts, Wins etc.). I've set everything to 0 for the time except names. There are around 280 TextViews. Now to update the stats from my PC Firestore seems to be the best choice.

How can I update every TextView efficiently? It would take too much time to write down the code for every data piece (assign string, setText etc.)

Alex Mamo
  • 130,605
  • 17
  • 163
  • 193
dp12
  • 1
  • 2
  • 1
    You create a model, you create instance of list of your model, you create listview adapter, and then feed that adapter to the listview. Then firebase/firestore takes of everything.. **[`Here's a video tutorial for you`](https://www.youtube.com/watch?v=kyGVgrLG3KU)** – Guruprasad J Rao May 18 '18 at 12:12

2 Answers2

1

If i am understanding you correctly , you are saying that you have 280 textViews in TableLayout. I would recommend using the recyclerview for this since its much more efficient and dynamic compared to TableLayout. Here is a tutorial for RecyclerView.

Dishonered
  • 8,449
  • 9
  • 37
  • 50
  • Can you elaborate in which way it can solve the problem? You don't have to go into detail. That's how the app looks like btw: https://imgur.com/a/KDUK0Zo Every text is a textview, which makes it too hard to update via Firestore. – dp12 May 19 '18 at 02:39
0

You need to avoid displaying so many views which are not recycled because you'll end up having very slow app. I also recommend you using a RecyclerView and for that, if you are interested, this is how you can retrieve data from a Cloud Firestore database and display it in a RecyclerView using FirestoreRecyclerAdapter.

Alex Mamo
  • 130,605
  • 17
  • 163
  • 193