Close Sidebar

Android - Losing focus on Item in ListView

0 votes

I have ListView with extendable items. Everything is working great until I trigger the dialog popup with EditText. Right after it animation just stop working. If I tap other button to animate the ListView container, everything coming back to normal.

In my ListViewAdapter I got item view in extends FrameLayout class and Animation is trigger when is called override onMeasure method with is not trigger after Soft Keyboard appear.

I think this is causing because there is no focus on particular item on the list? Off course regular click on the list item is working fine.

Strange is also this on that when I hide soft keyboard by pressing back button everything also working as it should be.

Thank you for any suggestions.

asked Jul 6, 2013 by ugochimbo (860 points)
can you please show some code so we could try to reproduce the problem

1 Answer

0 votes

When you trigger the dialog popup with EditText, save the focus of the list view:

int focusedIndex = lstView.SelectedItems[0].Index;

You can then restore it by using:

lstView.Items[focusedIndex].Selected = true;
answered Jul 6, 2013 by lordchimbo (150 points)
  1. Login or Register

    Click to open login box. Login or register from here

  2. Search Box

    Click to open the search box. You can search within the site content here

  3. Hello Admin!

    You can reach to admin section by clicking on this navigation item

  4. Ask A Question

    Start asking a question by clicking on this navigation item

  5. Find All Recent Activities

    Here you can find all recent activities recent question, answer, comment etc

  6. Vote Question or Answer

    You can give up or down vote to the question or answer by clicking on respective arrow button

  7. Give Your Answer

    Click this button to give your answer to the question

  8. Add Comment

    To post comment click on the button

  9. Select Best Answer

    Consider the answer as the best answer for your question by clicking one to the tick

  10. Congratulations!!!

    Now you learn how to use site. Why don't you start to ask a question or provide some answer to the community!