Search code examples
androidsearchxml-parsingdatamodel

How to Implement the Search functionality with in model objects in Android?


I am working on Android Application.

Now I have requirement of search the entered string characters inside the object data model.

here object data model i am creating with the data which is coming from webservice Xml. I am parsing the xml data and creating the class variables with setters and getters for each element in the xml .

Now my intention is to search the entered string from search field inside the created data class objects.

So can anyone share the knowledge about this functionality.

thanks in advance.


Solution

  • Following way, You can check whether your search string contains inside the string value in object:

    searchString.contains(obj.getMyItem())  
    // where getMyItem() is the getter method of custom class object