Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6642393
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T23:55:31+00:00 2026-05-25T23:55:31+00:00

I have a control Gridview and an XML that must populate the GridView. XML

  • 0

I have a control Gridview and an XML that must populate the GridView.

XML is:

<?xml version='1.0' encoding='iso-8859-1' ?>
<MEDS>
  <MED>
       <NOM>GELOCATIL</NOM>
       <COD>12812931</COD>
  </MED>
  <MED>
       <NOM>OTRO GELOCATIL</NOM>
       <COD>1281293222</COD>
  </MED>
</MEDS>

How do I create a Cursor for this? Or alternatives, pls?

Bye.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T23:55:31+00:00Added an answer on May 25, 2026 at 11:55 pm

    I think the right answer is to do an adapter class specific for this xml. But it is more complicated and takes more time. #Sravan has not provided the code so I am obliged to give this answer as right.

    We can look for a creative and easy solution although not optimized.

    If the case is that you only need 1 or 2 fields of the XML, which can be usual, because you’re showing a list that is clickable, so you need only to show to title and to give a substantial information (id for example or use the text of the title itself) so that when you click, takes you to another activity.
    So the easiest is to use an ArrayAdapter, a TreeMap and an ArrayList

    TreeMap<String, String> xmlMapping;
    //here you add the values of the xml with Xpath to the variables clave and valor
    xmlMapping.put(clave,valor);
    
    ArrayList<String> lista=new ArrayList<String>();
    
        for(Map.Entry<String, String> entry: xmlMapping.entrySet())
        {
            lista.add(entry.getKey());
    
        }
    
    
                ArrayAdapter ad=new ArrayAdapter<String>(this.activity.getApplicationContext(),
                        R.layout.gridrow,R.id.colName,
                        lista);
    
                grid.setAdapter(ad);
    

    Then to know which element has been clicked the only thing is to iterate through the xmlMapping or take the value of the ArrayList.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a GridView control in an Asp.net application, that has a <asp:buttonField> of
I have a gridview control that can get loaded with multiple pages worth of
I have a GridView control on my page that I have defined a number
I have a gridview control that has on onclick event bound to every cell.
I have a form that contains a GridView control which is databound to an
I wont to create a User Control based in gridview that have the edit
I have a WinForm app that displays results in a Gridview control. If a
I have a GridView control that for each item has a Hyperlinkfield with a
I have a GridView control on my ASP.NET page that binds to result set
I have a gridview control that i am manually binding the data in. When

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.