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).
Related
I'm working on an application that should allow the user to tag a user onto an item. In Google Drive, for example, when you're entering users to send an item to, the user's name becomes it's own "view" in the textview so that it cannot be modified and broken.
My current implementation already contains an autocomplete registry of current users, and formats the usernames with html tags so that they're interpreted correctly by the backend, but it's still possible to tamper by moving the cursor to the center of the name and modifying it.
I would like at least an example of how to accomplish what I am trying to do. The problem itself is hard to search for, probably because I just don't know what to call it.
Example of what I'm looking for: http://imgur.com/EBDoWED
Eventually, I came accross this: https://plus.google.com/+RichHyndman/posts/TSxaARVsRjF
Seeing that they're called "chips" is making this a lot more researchable. I'm still a bit weary about what I'm going to do, but I've got enough resources to start.
I'm going to attempt to make a LinearLayout that dynamically contains "chips" and edittext views and handles most of the functions of an edit texts.
This is not a pure programming question; rather it has to do with implementation details. It is required to implement an order processing screen where a customer makes an order consisting of multiple items. It is a two step operation whereby the user has to enter the name of the customer (or pick a name off of a list) and enter the order details (detail block in db terminology) and likewise enter the items or pick them off of a list. How is this transaction best carried out on an Android device?
(Please note that I am not asking about the programming of db operations rather about what objects are needed on the layout in order to implement such a transaction.)
About the implementation (no code), I am trying to give the most simple yet an efficient way to do this.
Give the user a choice (maybe buttons) to either enter name of customer or choose from a list.
If the option is to enter the name, some TextViews and Buttons would do the trick.
For choosing from a list, try a ListView.
On clicking any of the ListView terms, an Activity with TextViews and Buttons to take the order details.
For choosing the items, provide a Dialog Window with check boxes beside each item names.
Hope this helps. Get back to me if you need any help with the code.
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.
Ive been attempting to work out how to take the text from an edittext box and move it into a string array located in strings.xml.
Basically its a user form which the user fills in, onClick it adds the information to the database and is then viewable in a listview. The listview and everything works fine but i cant work out to put in information using edittext boxes.
Any hints or techniques would be very much appreciated.
Thanks
You want to take user input for an edit text, and put it in strings.xml? You can't do that. String resources are for static strings, not things that will change at runtime. You should look at other data storage options, like shared preferences. See data storage.
I could be wrong (someone please correct me if I am), but I don't believe strings.xml is editable at runtime. Rather, it's a set of predefined resources that your app has access to, and it cannot be modified by the program--only read.
If you're looking to make this information available to your app for subsequent uses, you should look at using SharedPreferences: http://developer.android.com/guide/topics/data/data-storage.html#pref
No way. You can't do such a thing. Surely not with strings.xml and androidmanifest.xml too.
The other option you have is: if you already have some values in strings.xml, you can fetch them in an list and append your own values that you want from user. After that, put it in an adapter and display it in a list view like you usually do.
I am developing an Android App which gives users an option 'Browse Alphanumerically'. Using this option let users view the list of items starting with a particular letter or number. Problem is that I cannot decide how to implement screen for this, which can work properly on any screen size. Please suggest me the best solution.
Thanks.
What I got from your question is that you want to show all alphabets and numbers to the user so they can jump directly to a entries start with the selected alphabet or number. If this is so, then one solution to your problem is use the Button or ImageButton any make a key pad of all alphabet and numbers. Don't forget to make them flexible enough for different screen sizes. Cheers.
Use a list activity. There are lots of tutorials on Google's developer site. When you want to narrow the list, just assign the smaller list to the ListView. Just filter your master list, sort it, and assign it to your list adapter.
Hope this was helpful.