Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting empty text causes crash #9

Closed
anggrayudi opened this issue Mar 22, 2018 · 3 comments
Closed

Setting empty text causes crash #9

anggrayudi opened this issue Mar 22, 2018 · 3 comments

Comments

@anggrayudi
Copy link

I knew that setting empty text array is not allowed. But, what if we want to set it during runtime only, instead of initially setting it with app:texts="@array/my_texts"?

We can show an empty text if the array is empty. Throwing IllegalArgumentException directly is not a good action.

@rosenpin rosenpin added the bug label Apr 14, 2018
@rosenpin rosenpin added enhancement and removed bug labels May 20, 2019
@shofiulla-iota
Copy link

To avoid crashing i have added a static array from string resource in xml and then add dynamic array from java file. I know it's not smart solution but for my case it's working fine.

@rosenpin
Copy link
Owner

The issue with this proposal is that it would be problematic if no static array would be chosen, what would the textview show until you set the text dynamically?
In most cases, the view will render before you get a chance to set the text, what should the default behavior be in this situation? Presenting an empty textview? that could be reasonable if not for the fading animation loop.

If you have an idea for the default behavior for an empty static string array let me know

@rosenpin
Copy link
Owner

rosenpin commented Aug 7, 2022

There is now a FTV.placeholder built into the library string arrays.
If you want to leave the FTV empty until you update it at runtime you can use FTV.placeholder.
If users don't provide any string array, the app will crash with a proper error message

392f76a

@rosenpin rosenpin closed this as completed Aug 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants