开发者

Android Autocomplete text how much is too much data

开发者 https://www.devze.com 2023-02-16 07:14 出处:网络
I am looking into using the AutoComplete against a database. The DB has about 10,000 for the table I need to query.

I am looking into using the AutoComplete against a database. The DB has about 10,000 for the table I need to query.

I have been trying to find sample code to show how this works, but yet to find anything. Suppose the table has ID and Description. I need to search against the Description in the AutoComplete. I found code to search the contacts DB bu开发者_如何学Ct I do not know Java well enough to convert t that idea to my own SQLLite DB.

If I had the code to test this I could answer my own question I would guess. Just wondering if the 10k records would be too much and would slow it done?

Does anyone have any thoughts on this and also does anyone have detailed code that shows how this works?

thank you!


10K in-memory strings would be too much for most Android devices. Assuming you don't get an OutOfMemoryException error, your app will constantly garbage-collect, and your performance will suffer as a result. Assuming your strings are of average length (around 128 characters long), I would recommend storing no more than 250 in memory at any given time.

A better approach would be to repeatedly fetch data from the database; grabbing around 15 records per fetch.

0

精彩评论

暂无评论...
验证码 换一张
取 消