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.
Related
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 dread designing UI for Android apps, and I have been searching and trying every possible combination of things to get this the way I want it, but I just cannot seem to get it right.
I want to have a simple Android app that has a text field and a send button next to each other on the bottom of the screen (I already have this correct), and I also want a functional chat area filling the rest of the screen above.
It obviously needs to be scrollable, and I would like to be able to add a new line to the bottom of the chat by doing something like chatBox.add(username, text).
This is the type of view I am looking for:
<bob> my name is bob
<bill> hi bob, my name is bill!
<bob> we are having an awesome conversation, bill
<bill> both of our names start with a b
<bob> how right you are
I had made such app. For chat window I used listView. ListView has stackFromBottom mode. So the last added messages will be on the bottom of ListView. Also I created custom Adapter extending ArrayAdapter, so it is easy to add new messages.
Here is a nice example, how to use listView with adapter and add new items.
Leonisdos is right, you shoud use listView. Do you know the app Irssi-ConnectBot ? I think you should have a look in its source code to have many good examples.
Here the code.google project of Irssi-connectbot (and the github)
Wrap a TextView in a ScrollView. Use append() on the TextView and fullScroll(View.FOCUS_DOWN) on the ScrollView when you append new chat entries.
For longer chats, Leonidos' ListView approach is more efficient, but I thought I'd mention this one.
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...
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.