I am new to Android Development and I am making an application in which I have an EditText and below EditText there is submit Button.
I want that when I write something in EditText and then click submit, the Edittext value will show in Listview with pre defined two Images i.e. their is EditText value in listview and on the right of it two Images also added with that Submit button. These images are Delete and Edit Images so that whenever i click on delete it delete that item and whenever i click on Edit image the EditText value will be ready for editing.
I know that this will be done by getView method and a holder but i could not find any best example for that.
Can anyone provide me the best example for holder and custom listview regarding my application?
Related
i am trying to implement that, when click on edit button (shown last two in image)
then that row should be editable mode with specific edit text and then click on save button that updates value should be change.
But major issue is that when click on edit button that row is editable but in bottom some other row is also randomly editable automatically and i cant handle this .....totaly frustrated with this issue please give any solution for this.
another issue is that after edit value when scrool list then updated value change and orignal display there ...so how can i manage all that thing is there any demo which match with my requirement plsss help......
adpater class
getview method
save button click
edit button click
checkbox event
delete button click
position handle logic
position handle logic
How can i create an android listview with row 1: textview + spinner row 2: textview + edittext etc.?
I have to make a form and i make it with xml layout but it's too long and bad for perfomance as the eclipse says.
Thank you!
ListView can be used if there is a repetition of same views in every row. This is where you get performance benefits given by adapters' recycling view mechanisms. With every row having different views they cannot be recycled and therefore no point in using the listview there.
So based on what kind of rows you have here are two solutions:
Solution 1:
Row 1 has textview + spinner, Row 2 has textview + EditText. And this combination repeats for the rest of the rows then you can try this. The xml where you create the layout of individual row for the ListView should be made a LinearLayout having two rows. ListView will create the rest of the rows for you by appending this LinearLayout.
Solution 2:
If each row is completely different from other (in terms of views used) then I would suggest using pagination. Divide your form questions into different relevant groups put each group on one page (scrollview). When user answers a set they have to navigate to the next page and so on.
As suggested by #Xaver Kapeller, I'd also suggest not using EditText in a ListView. It is very painful to debug keyboard issues and when the device orientation changes with keyboard open then as well. Instead of EditText ,use TextView which on tapping opens a Dialog box with a EditText. To keep the user interaction minimum.
You can focus the EditText as soon as the dialog open so that keyboard opens and user does not have to tap on the EditText. You can also dismiss the dialog by pressing the imeAction like Done on the soft keyboard or by pressing the hard back button. Dismissing the dialog should trigger a textview.setText("Data entered in the dialog box").
I don't know if this is the right method but I would like to know if is it possible to show a Listview when the user clicks on an EditText/TextView and show afterwards the selected item text in this EditText. I know how to declare the EditText in the layout but is there any example of when clicking on the listener show the ListView? Do I need to add this Listview in the XML layout or do I have to add it programatically?
Thank you
if your app wants to have a sort of text viewand when you click on it you need to show up a list view then you can use expandable list view check this tutorial
http://theopentutorials.com/tutorials/android/listview/android-expandable-list-view-example/
Sorry, a I was looking just for a Spinner, I thought that it was another type of ListView
in may application, i have a spinner widget that contains huge amount of data.
it is hard for user to find his item between them, so i decided to insert search capability for content of spinner.the idea is If the user taps the quick search button he should be provided with a text field to enter a letter and then the spinner list jumps to the fist word it finds with the letter supplied.
is there any solution to that?
thanx
Let us assume, full Spinner data is list.
Initialize
listCurrent=list.clone();
set ArrayAdapter on spinner by
ArrayAdapter<String> adapter=new ArrayAdapter(context, android.R.layout.simple_spinner_item_1, listCurrent);
override onTouch event, open dialog containing edit text say editText and a button on tap, else select item, in dialog button click, get String from editText and filter results and reset adapter by invoking:
listCurrent= filter(list, text);
adapter.notifyDataSetChanged();
Easy way to do things you want is
Have an Button which contain the Text of Selection.
When the Button is clicked Open the Dialog or Activity(startActivityForResult) containing the ListView with EditText.
update the listview with the Searched content in EditText.
When user click on an Item in the ListView. finish the Activity with result.
and update the Text in Button from onActivityResult.
You can use auto-compilation...
i want to edit the particular list item after the,all data loaded into listview using base adapter.
we can achieve this by reloading the listview with edited value,but i want to do this without reloading the entire listview data.bcoz the data is huge
If I understand ur question properly, When the list item is clicked, u need to make it editable.
Keep two views, one for editing ( EditText ) another TextView for showing.
On Click of list item or TextViw, make TextView Gone and make EditText visible.
When the editing done ( may be other list item click or Done button of keyboard ) copy the content of EditText to TextView and make EditText Gone and TextView visible.
I have done the same for some of the requirement I had in my pet project