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!
Related
I'm quite new to android studio so be easy please.
For now I'm doing my best to implement MVVM pattern using Kotlin.
I want an app which is shows Persons in a list (For now I'm using Recycle View with a Text View inside). I want user to be able to tap on a Person and after tap Person card would pop up. The questions are:
Which component should I use instead of Text View to observe user's tap?
Which components should I use for Person card? Person(Name, Last name, Age, Avatar(jpg img))
You can just use the text view. Just set an onClickListener to know when someone taps it.
Depends on the exact UI you want. A dialog might fit, with whatever you want inside it.
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/
The use case is the following:
for instance I added a text on an image. Saved the image. And now I want to edit this text. I am looking for a solution to open this image with a text in an editor with a possibility to make this text editable. In general, I need to do the same not only with the text.
What I thought about the way to implement such behavior is it would be good if there is some list of the operations applied to the particular image. And also a way to make editor apply these operations again and to have editing components active and available for editing
You can achieve this behavior by utilizing the serialization feature. More information about that is available at https://docs.photoeditorsdk.com/guides/ios/v8/concepts/serialization for iOS and https://docs.photoeditorsdk.com/guides/android/v5/concepts/serialization for Android.
I need an advice about ListView.
A give you an example:
Assume that i have a map. If i'll touch some place on it i'll get an information about that place and then, on screen, a dialog fragment will appear. In this dialog i can write a name of place, which i touched. The names should be saved into ListView but if i'll click on some of them i want to get information.
Can some of you tell me how i should do this? Is it possible to save that information in Shared Preferences?
Maybe you would get it work with SharedPref. but it isn't a nice way to that. I think the best way is to create an Android SQL-DataBase. Like in every other Database you could use one column for the name, one for the information text, one for coordinates and so on (that's just an example). The data will stay, also if your app is closed (like SharedPref).
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.