Reputation: 1811
I am having nested scrollview
with 100 layouts. All layouts are initially will be empty. When user scrolls and stops the scroll I will send request to the server and update the layout. I am facing issue doing both parallel. When request sent to server and receive response I am updating the layout using following code:
((Activity) ctContext)
.runOnUiThread(new Runnable() {
public void run() {
reDesignLayout(layoutID);
}
});
But the problem is I am not able to scroll the scrollview
while updating. I tried with Handler and runOnUiThread
. But both not able to scroll. Please help me on this.
Upvotes: 0
Views: 263
Reputation: 21
If you want to update data in that process, you would need to create an id, find the view, and assign them each and every time. That would mean you would need to write code to assign 100 different ids to 100 different containers containing your views. And assigning values to all of them would be a real pain, if not unreal. And it's not at all advised for this case.
Instead, I would recommend using a recycler view. Which is the best that is available. It decreases the amount of code you write and the memory space needed as it is based on the concept of reuse and helps populate data efficiently.
You could visit the link below, to learn more about recycler views. Hope it helps.Happy coding!
https://guides.codepath.com/android/using-the-recyclerview
Upvotes: 1
Reputation: 2296
I think the using of the Scrollview isn't suitable for your case. Try to switch to RecyclerView with an adapter. Benefits:
Upvotes: 1