Siva K
Siva K

Reputation: 4968

logical problem in an android app

hi i would like to know solution for such a problem..... i have an xml file containing users data of around 1000 users listed out in alphabetical order. The xml file use to be as follow

<usersdata>
    <user>
         <id>1</id>
         <firstname>A</firstname>
         <middlename>AA</middlename>
         ......
         ......
    </user>
    <user>
         <id>2</id>
         <firstname>B</firstname>
          <middlename>BB</middlename>
           ......
           ......
    </user>
    ........
    ........
</usersdata>

Now from the above xml file i am parsing all the tags and storing them in an array list for each tag. I am listing out the Firstname in a listview, by array list of first name. When the any of the list is clicked, it opens up a new activity where the all other details of the selected name is been shown.

For example if third name in the list is clicked, by using its position(example 3), in the next activity i am listing out the third values stored in all the array lists i am using. This is what currently i am doing.

Now the problem is i have a edit box above the list view, named as a search box. If the letter S is typed in it, then all the names starting with S gets listed first. Opening the next activity by clicking the list now gets some wrong data, how to avoid this.

Please give me a suggestion....

For example if the first name C is clicked, it will be listed at position 3

Upvotes: 0

Views: 588

Answers (2)

Siva K
Siva K

Reputation: 4968

i tried out by setting some flag and by using an example code in developers site. And i am able to list out the data's but this idea does not full fill my apps requirement in the next activity. So i removed the search part in my app.

Sorry for posting such a question here......

Upvotes: 0

Ash
Ash

Reputation: 1721

There is a quick and dirty hack: you can store user id in the invisible field, retrieve it on click and use it as an argument for the second activity. I'm afraid I can't come up with better suggestions without seeing the code.

Upvotes: 1

Related Questions