I'm building an Android app whose settings include a blacklist, so the user can input a list of words. I took a look at the TextPreference but it doesn't really fit the scope since it's a dialog with little space.
Is there any preference (built-in or library) I can use for inserting a list of words? A bigger text area with no dialog should be enough. I didn't think that such a simple preference is not available.
Storing a blacklist of words is probably a little out of scope for SharedPreferences, since they are designed to maintain simple key:value pairs.
You should create a new Fragment that allows users to manage the blacklist and then implement your own data persistence. If you use Sqlite and create a clustered index on the column word, you will have O(log(n)) search. Opposed to O(n) search that scanning the csv values of shared preferences would yield.
There are no built-in preferences that provide behavior like that. Also no libraries that i know of.
I recommend creating a custom Preference for this. Internally the preference-v7 layouts setttings screen contains a RecyclerView. So you need to override some sort of ViewHolder logic (PreferenceViewHolder)
This could be usefull: http://www.hidroh.com/2015/11/30/building-custom-preferences-v7/
Related
How could I make a user Interface like the one with NumberPicker but the data came from the SQLite. Is there a Layout for this?
Like this User Interface
What do they call this Interface?
I'd like to create a view data from SQLite. Some what like
Apple
Banana
*Cake*
Donut
Eclair
Don't recommend using DialogFragment. I wanna do like this
Scrollable List
Unfortunately there is no layout that does that out of the box, so you will have to do a lot of heavy lifting before getting things working. But the easiest way is to use NumberPicker and pass to it the values that you want to display as an array with setDisplayedValues. But you still have to create the connection to the database and query for the cursor that you will have to transform somehow to an ordered array, for which you can then map the values of the NumberPicker to the actual values in the database (told you, not easy...).
There is no easy way out of this, you could also try making your own component or buy one that does this for you.
This is what I've been looking for.
https://play.google.com/store/apps/details?id=antistatic.spinnerwheel.demo
Source code: https://github.com/ai212983/android-spinnerwheel
I would like to ask if my concept of implementing search in my application is correct and whether it could be improved. I will provide any details needed therefore I believe my question is well-suited for this site.
I need to implement a search over large SQLite tables (~20 columns,
possibly 1000-1500 records - you can think of it as a catalogue of
items in a supermarket). The search should be performed on more than
1 table (i.e. 1 catalogue) but I can also force the user to choose
specific table (though I would like to avoid it).
To make the search efficient, I'll use the SQLite FTS3 tables.
I want to make a fast search that will quickly show results as the user types a query string. For example, when a fragment of
product manfufacturer is entered all of the products matching that
string should be shown. The perfect solution would be if the user
could enter fragment of one column and fragment of another at the
same time, though I think that could be a little too much for an
Android device.
Questions:
Should I use a SearchView together with a a ListView (and show search results in the ListView) or should I use the AutoCompleteTextView?
Are the FTS3 tables the right way to go (i.e. will it be fast enough) to effectively perform search over several (large) tables?
I am targeting Android versions >= 3.0.
If you want to have a few line of code, you should use AutoCompleteTextView for it has ready built-in listener (ontextChangelistener -- wherein you can show the suggestions every time the text changes ) and list/ container for suggestions.You can create your own adapter to customize the design of the list.
FTS3 or FTS4 would be great in querying big amount of data.
I need to create a properties grid in my application to allow the user to read (initially) and eventually edit the properties of an object that I display using a custom list adapter.
I did some research and found that Android has the preferences activity, which sounds good as far as the UI portion, but I don't want to actually save "preferences", I need an edit screen.
Is there a way to have a dialog created which will use reflection (sorry, .net term) to create the dialog allowing the user to edit each property of an object, or do I need to create this manually? Either is ok, I just need to know. Thanks!
I have a button on my home screen that will add an edit text field every time it is pushed (I limited it to 20 for best practice). It is basically a small budgeting app. I want the user to fill in an X amount of dollars in one of the fields. Then, when they are ready, to come back to the app another time and that created EditText is still there filled with the value. I know how to utilize SharedPerfrences to hold the value. I do not, however, know how to hold that newly created EditText field when the user comes back.
I am acutally going to expand and have a button and a datepicker associated with each EditText field so soon click the button will create three objects, not just one. But I want to get one working first and will apply the principle to the others later. Any suggestions?
Sounds like a good candidate for a SQLite database.
For instance, I use a SQLite database to retain and recall the co-ordinates and types of widgets that the user has arranged within my application.
Note that you don't ever want to be trying to store and recall the actual EditText View object itself. In your database you need to devise your own table format that suits the kind of information you need to store. If you simply need to retain the states of a series of EditText fields then this could be as simple as having a table with just one column that contains a string value on each row. To build your UI up again from that database, you'd loop through and create a new instance of EditText, and set the text of each one from the table.
You would have to use Android Parcelable interface, refer to this to know as of how to implement it, refer to this question which I has asked on StackOverflow, it has a good answer.
I am working on app which have data entry form which have
Some fields with 3 drop down associated to it.
More then 25 input fields (input box, radio button, drop downs etc)
All input fields are grouped into 3 categories
My question are:
How to display field with 3 drop downs associated with it ? Because of a small screen size it cannot be displayed horizontally.
What is the best way to represent 25+ fields ? I tried scroll view and tabs but don't find it so pleasing.
For example if you consider date then it may have three drop downs for date , month and year. (Its just example I have fields different than date)
What is the good way to have fields in a category together with appealing UI.
PS: My app is related to Hospital so it has to be pleasant .Which also means I cannot use glossy background or image.
You might want to check this site for general Android UI design ideas. Here are some for your particular cases:
re-design your UI to only show what is needed. It's unlikely that all 25 fields are used all of the time. Consider separate screens for different use cases, and/or some sort of wizard-like UI (fill in the basics, press next, fill in details, etc.)
if you really need to display all of this, consider using a tablet, not a phone to run the app (assuming this is to be used in the field, and you have some control over devices).
instead of tabs, you might want to try something like ViewPager. It doesn't take as much space as tabs, and the number of views is practically unlimited.
Maybe like this...
You can use the library QuickAction which allows to create some kind of context menu.
To keep a simple screen view, you can only display the current values. Several on the same lines for the same category.
Then, if the user click on a value or category, you trigger a QuickAction with the actions available for the category or values: Edit, clear, ...
For each action, you can also show a dialog to update/fill the field which has triggered the action...