Alef
(Alef)
April 24, 2021, 8:40pm
#1
Hello everyone
Could anyone tell me how the ListView FilterBar works?
I have a spreadsheet with 2,000 rows and 3 columns stored in a variable.
Searching for Listview’s FilterBar, it looks like magic !! The search result is acquired instantly.
But if you use the textbox, the result (.On Text Changed), causes the app to crash.
Why does this happen?
Summary
Delay:
No Delay:
Taifun
April 24, 2021, 8:52pm
#2
It would really help if you provided a screenshot of your relevant blocks, so we can see what you are trying to do, and where the problem may be.
To get an image of your blocks, right click in the Blocks Editor and select “Download Blocks as Image”. You might want to use an image editor to crop etc. if required. Then post it here in the community.
Taifun
I am also eager to know the difference between these two procedure from the moderators or from the experts .
1 Like
Alef
(Alef)
April 24, 2021, 11:54pm
#5
Discovery of the year !!
Just wait . . . Soon we will know!
TimAi2
(metricrat)
April 25, 2021, 9:13am
#6
Where do you initiate the listener (using block) ?
Alef
(Alef)
April 25, 2021, 11:27am
#7
What do you mean by listener? Any dynamic component that I failed to learn?
TimAi2
(metricrat)
April 25, 2021, 11:49am
#8
Oh sorry, you have the built in component…
Alef
(Alef)
April 25, 2021, 12:11pm
#9
The only point that makes me think here, is the fact that the search is so slow using the textbox.
It makes no sense to me.
Taifun
April 26, 2021, 1:43am
#10
your for each item in list solution is slow for the numer of records (2000)
let me suggest you to use the local Sqlite database for that purpose…
SELECT column1, column2 FROM myTable WHERE column3 LIKE '%Textbox1.Text%"
Taifun
Alef
(Alef)
April 26, 2021, 2:34am
#11
Oh yeah. The consultation would be better.
But about the title, why is the query in the textbox so slow and not in the listview?
ps: Is there any way to insert the text in the textbox and go to the query search field inside the listview?
Taifun
April 26, 2021, 7:02pm
#12
the filter in the listview is fast, because it is done in Java, for details see the sources
// -*- mode: java; c-basic-offset: 2; -*-
// Copyright 2009-2011 Google, All Rights reserved
// Copyright 2011-2020 MIT, All rights reserved
// Released under the Apache License, Version 2.0
// http://www.apache.org/licenses/LICENSE-2.0
package com.google.appinventor.components.runtime;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable;
import android.graphics.drawable.StateListDrawable;
import android.text.Editable;
import android.text.Spannable;
import android.text.SpannableString;
import android.text.TextWatcher;
import android.text.style.AbsoluteSizeSpan;
import android.text.style.ForegroundColorSpan;
import android.view.View;
This file has been truncated. show original
no…
alternatively you can use JavaScript toegether with the webviewer component for another fast solution
Taifun
1 Like
Alef
(Alef)
April 26, 2021, 7:29pm
#13
Thank you for that.
I’m going to research about it, but … if I have a guide for that, I appreciate the sharing.
One last question:
It is possible to increase the size of
nope
you can’t change its size, design, etc
Alef
(Alef)
April 27, 2021, 2:50pm
#15
It would be perfect if you could type in the textbox and receive the value there or just increase the size of the layout.
Well, thanks for the explanation!
Alef
(Alef)
May 15, 2021, 4:14am
#16
Anyone who, like me, encounters crashes when filtering data from a large list and displaying it in a listview using the “When ‘textbox’ .On Text Changed” block, know that adding the “Timer” will prevent your smartphone freeze for a few moments while typing new characters !!
No need to freeze just use if the length of the text is greater than 3or4 make it to show the filtered list
system
(system)
Closed
June 14, 2021, 8:38am
#18
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.