enter code hereIn my android application , there is a populated tableview with favorite products. There is a delete functionality to delete products from the list. How can i show this to user that he can delete products? like in ios there is a method called commiteditingstyle.
What are the options in pure android way to edit tablerows
longclicklistener and show a delete button on table row
show a checkbox on edit button
any other
That's really just up to your imagination. I think typical android UI would just use the flick to remove, but some like the longpress or a button, some use an "Edit List" option which adds a checkbox next to each item on the list and then gives the user an option to delete selected items(best for managing large list or batch quantities).
Hope that helps! Good Luck!
Related
I am working on xamarin.forms. I am creating an app for android. In app I have a dropdown list. I am using Picker for it. I customized it to look like dropdown. Now I need to make the first Index item to nonselactable. Means user can not select the first item. If user click on it nothing should happen. But currently when user click on the first index dropdown gets collapsed.
One more thing that I have to add in dropdown is a Cross button at index 1. Means at index 1, on left side there will be Cross button and at center there will be text like Select item. And this whole row should not be selctable. If user click at cross button dropdown should collapsed.
Anyone have idea how I can do this?
You can use listview for dropdown and control its visibility as per need.I faced similar situation where I customized list view to enact dropdown.There is another thing I want to know about Picker.Does your picker accepts or adds string only or you could customize it to accept views or controls?
I wish to select multiple ListView items and then share all of them. How can I go about it?
See the Awesome example here android-multiple-selection-listview
Well,
First you need to create OnItemClickListener(View v) in order to get clicks.
Then you can make a HashMap in order to preserve the items which are clicked.
You can also change the Background of the clicked item so the user will know which items are clicked.
Final thing you need is the action (button click - Share) which will pass through the HashMap and collect all clicked items. After that you can do with them what ever you want.
It looks like a huge work, but it's can easily divided into steps and you close them one by one... It actually quite simply.
I want that on the click of the option menu item in action bar, the listview's choice mode becomes multiple, which is easy to achieve. Simultaneously i want to inflate two options menu items namely "ok" and "cancel", so that once the user is done selecting some or all listview items, he can click on "ok" option menu to proceed.
I have to display list of items along with a plus(+) sign , on click of plus sign list should expand & on click again list should shrink
You can do this but would need to do more work
as you want to show
name ,address and plus sign should changed to minus ,
you would require to make a custom list view and what you can do is use
when plus button is clicked in list
nameText.setVisibility(View.VISIBLE);
adress.setVisibility(View.VISIBLE);
btn.setBackgroundResource(R.drawable.minus);
and when minus button is clicked
nameText.setVisibility(View.GONE);
adress.setVisibility(View.GONE);
btn.setBackgroundResource(R.drawable.plus);
If you want to create a tree view like windows, then it is not a UI element that is supported by android. The similar to this is the ExplandableListView element.
Although in one business application I have found this http://code.google.com/p/tree-view-list-android/ project that does exactly what you want.
I am showing list of all the applications installed on the phone with the help of the packagemanager in the listview and there is a checkbox along with every application name shown in the list. I want to save the name of the applications against who the user has selected the textbox. The saved items will be used to generate a list of favorite apps.
You can Save it in the your database while the user presses on the check box and delete if it is already present in your database if the user unchecks it.You can use listener and put your code of saving inside your listener.
You should add a listener to your checkboxes => OnCheckedChangeListener
You will then be notified each time the state of the checkbox change, if the checkbox is checked, you can add the element to a list, if it is unchecked, you can remove the element from your list.
This requires you to have your own adapter thought.
Good luck and have a nice day
You need to make custom listview with checkboxes : here is one example for you.
You will need to have one Button below/above the Listview clicking on what you can take all the items and store it into your database : a complete Articale for that.
Now you can fetch the data from database anytime to show those favourite apps.
I am new to Android, and am trying to develop an app that presents a list of choices with a textfield next to each that allows the user to enter in quantity information related to each item.
What would be the best way to impliment this? Currently my app is using a buttonlist with checkboxes next to each item to select it. I'd like to expand this so that I can select multiples of the same item.
Any help is appreciated.
Thanks,
Jason
I'd use a Spinner for the item and an EditText for the quantity.