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 6000331
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T00:40:40+00:00 2026-05-23T00:40:40+00:00

in my app i am trying to form a grid view from the xml

  • 0

in my app i am trying to form a grid view from the xml file that been stored in web.

Following is my code

grid = (GridView)findViewById(R.id.gridView1);
imageXMLfn();
grid.setAdapter(new ImageAdapter(this));

private void imageXMLfn() 
    {
        try
        {
            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
            factory.setIgnoringComments(true);
            factory.setCoalescing(true); 
            factory.setNamespaceAware(false); 
            factory.setValidating(false);

            DocumentBuilder parser = factory.newDocumentBuilder();             
            URL url = new URL(UserManual.IMAGE_URL);
            Log.e("ViewImage3",""+UserManual.IMAGE_URL);

            Document document= parser.parse(new InputSource(url.openStream()));            
            NodeList sections = document.getElementsByTagName("application");
            numSections = sections.getLength();
            for (int i = 0; i < numSections; i++) 
            {
                Element section = (Element) sections.item(i); 
                if(section.hasChildNodes()==true)
                {
                    NodeList section1=section.getChildNodes();
                    for(int j=0;j<section1.getLength();j++)
                    {
                        if(section1.item(j).hasChildNodes()==true)
                        {
                             for(int k=0;k<section1.item(j).getChildNodes().getLength();k++)
                             {                  
                                 xmlvalue=String.valueOf(section1.item(j).getChildNodes().item(k).getNodeValue()).trim(); 
                                 arl.add(xmlvalue);
                             }
                         }
                     }
                  }
               }
            } 
            catch(Exception e)
            {   
                System.out.println(e);
                Log.e("ViewImage Error1",e.getMessage());
            }

            Iterator<String> itr = arl.listIterator();
            int z=0,x=0,increment=0;
              while (itr.hasNext()) 
              {
                id = itr.next();
                img = img+id;
                z++;
              }           
    }


public class ImageAdapter extends BaseAdapter 
    {
        private Context myContext;

        private String[] myRemoteImages = {id};

        public ImageAdapter(Context c)
        { 
            this.myContext = c; 
        }
}

Either i am getting only the first image stored in that url or else i am not getting any other images

Following is the link from which i am trying to get the images

http://94.23.207.167/websiteIphone/Admin/XML/Santa.xml
  • 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-23T00:40:41+00:00Added an answer on May 23, 2026 at 12:40 am

    Your code is not complete, so it’s a bit difficult to give a definite answer but in the while loop at the end if imageXMLfn you’re assigning id = it.next(). The image adapter than uses only id which is set to the last value in the iterator. Supposing that arl is a field in your class of type ArrayList<String> it probably can be solved by:

    public class ImageAdapter extends BaseAdapter 
    {
        private Context myContext;
    
        private String[] myRemoteImages = arl.toArray(new String[arl.size()]);
    
        public ImageAdapter(Context c)
        { 
            this.myContext = c; 
        }
    }
    

    However, your code is really incomplete in this regard, so I’m not sure whether this will work out.

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

Sidebar

Related Questions

I have a web app with a form that I am trying to pass
I'm trying to build a web app using Dojo. I have a form that
I'm trying to create a C# form app that will allow me to use
im trying to write an app that will display a list off lines from
I am trying to load an HTML Form stored locally into my android app,
i'm trying to create an app that would present a form to the user
I'm trying to create a windows form app that will be able to handle
I'm trying to create a multi-level ajax form on my rails app that can
I'm trying to include in my Windows Form App a way that when user
I'm trying to build a PHP form that outputs custom JSON code. Take a

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.