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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T20:59:04+00:00 2026-06-06T20:59:04+00:00

I am new at developing Android apps. What I want to do is get

  • 0

I am new at developing Android apps. What I want to do is get data to store into an array and display that data into a list activity view. In a way, the app is going to be similar to a parsed tree where click on one item in the list will take you to a different item and so on and so forth. The thing is I’m going to be having multiple different lists and most are going to be connected somehow (depending on the category selected before hand). I have been looking into the MapsDemo sample application and know there’s a way – however I have yet to figure it out. If this is confusing at all please let me know…

Thanks all

  • 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-06-06T20:59:05+00:00Added an answer on June 6, 2026 at 8:59 pm

    Try this out for starters, then once you can do this, then move to using dynamic data. I used this for a very similar project and worked well:

    http://www.ezzylearning.com/tutorial.aspx?tid=1763429

    Here is the code I used. Maybe this will help you:

    protected void onCreate(Bundle savedInstanceState) {
            // TODO Auto-generated method stub
            super.onCreate(savedInstanceState);
            this.setContentView(R.layout.dining);
            //Hard coded array
            ListData newListItem = new ListData();
            ArrayList<ListData> itemObject=null;
            try {
    
                 itemObject= newListItem.getData(DATAURL);
                 Log.e(TAG, "item object: "+itemObject.toString());
                 ListAdapter adapter = new ListAdapter(this, R.layout.dininglistview, itemObject);
                 //Create listview
                 this.listView1 = (ListView)this.findViewById(android.R.id.list);
                 this.listView1.setAdapter(adapter);
    
            } catch (InterruptedException e) {
                // TODO Auto-generated catch block
                Log.e(TAG, "Unexpected error", e);
            } catch (ServiceException e){
                AlertDialog alertDialog = new AlertDialog.Builder(DiningActivity.this).create();
                alertDialog.setTitle("Temporarily unavailable");
                alertDialog.setMessage("Please contact top25@uievolution.com");
                alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
    
                    @Override
                    public void onClick(DialogInterface dialog, int which)
                    {
                        Intent homeIntent = new Intent(DiningActivity.this, HomeActivity.class);
                        DiningActivity.this.startActivity(homeIntent);
    
                    }
                });
                alertDialog.show();
            }
            //implement dining adapter
    
        }
    

    Here is the getData() method that I used to parse the XML:

    public ArrayList<ListData> getData(String DATAURL) throws InterruptedException, ServiceException {
    
            ArrayList<ListData> items=null;
    
    
            HttpURLConnection conn = null;
            try {
                URL url = new URL(DATAURL);
                conn = (HttpURLConnection) url.openConnection();
                conn.setReadTimeout(TIMEOUT);
                conn.setConnectTimeout(CONNECT_TIMEOUT);
                conn.setRequestMethod("GET");
                conn.setDoInput(true);
                conn.connect();
                if(Thread.interrupted())
                {
                    throw new InterruptedException();
                }
    
    
                 items = parseXML(conn);
    
    
    
            } catch (MalformedURLException e) {
    
                Log.e(TAG, "Invalid URL", e);
            } catch (IOException e) {
                // TODO Auto-generated catch block
                Log.e(TAG, "Unable to connect to URL", e);
            }
            finally{
                if(conn!=null){
                    conn.disconnect();
                }
            }
    
            return items;
    
        }
    

    Here is my parser:

    private static ArrayList<ListData> parseXML(HttpURLConnection conn) throws ServiceException {
        ArrayList<ListData> dataArray = new ArrayList<ListData>();
    
    
        DocumentBuilderFactory builderFactory =
                DocumentBuilderFactory.newInstance();
        DocumentBuilder builder = null;
    
        try {
    
            builder = builderFactory.newDocumentBuilder();
        } catch (ParserConfigurationException e) {
            Log.e(TAG, "Parse Configuration issue", e);
            throw new ServiceException("Service Exception Error");
        } catch (IllegalAccessError e){
            Log.e(TAG, "Illegal Accessor Error", e);
            throw new ServiceException("Service Exception Error");
        }
    
        try {
            //parse input from server
            Document document = builder.parse(conn.getInputStream());
            Element xmlElement  = document.getDocumentElement();
            NodeList recordNodes = xmlElement.getChildNodes();
    
            //assign parsed data to listItem object
            for(int i=0; i<recordNodes.getLength(); i++){
    
              Node record = recordNodes.item(i);
              NodeList recordDetails = record.getChildNodes();
              ListData listItem = new ListData();
    
              for(int ii=0; ii<recordDetails.getLength(); ii++){
                 Node detailItem = recordDetails.item(ii);
                 String detailType = detailItem.getNodeName();
                 String detailValue = detailItem.getTextContent();
    
                 //assign attributes to listItem object
                 if(detailType.matches("item")){
                     int itemValue = Integer.parseInt(detailValue);
                     listItem.setItem(itemValue);
                 } else if(detailType.matches("title")){
                     listItem.setTitle(detailValue);
                 } else if(detailType.matches("subhead")){
                     listItem.setSubhead(detailValue);
    
                 } else if(detailType.matches("thumb")){
                     ImageManager im = new ImageManager();
                     Bitmap tImg = im.getImage(detailValue);
                     listItem.setThumb(tImg);
                 } else if(detailType.matches("photo")){
                     ImageManager im = new ImageManager();
                     Bitmap pImg = im.getImage(detailValue);
                     listItem.setPhoto(pImg);
                 } else if(detailType.matches("localAddress")){
                     listItem.setLocalAddress(detailValue);
                 } else if(detailType.matches("phone")){
                     listItem.setPhone(detailValue);
                 } else if(detailType.matches("webUrl")){
                     URL webUrl1 = new URL(detailValue);
                     listItem.setWebURL(webUrl1);
                 } else if(detailType.matches("facebook")){
                     listItem.setFacebook(detailValue);
                 } else if(detailType.matches("twitter")){
                     listItem.setTwitter(detailValue);
                 } else if(detailType.matches("latitude")){
                     float itemLat = Float.parseFloat(detailValue);
                     listItem.setLatitude(itemLat);
                 } else if(detailType.matches("longitude")){
                     float itemLon = Float.parseFloat(detailValue);
                     listItem.setLatitude(itemLon);
                 } else if(detailType.matches("notes")){
                     listItem.setNotes(detailValue);
                 } else if(detailType.matches("comments")){
                     listItem.setComments(detailValue);
                 }
    
              }
              dataArray.add(listItem);
    
            }
    
        } catch (SAXException e) {
            //TODO
            e.printStackTrace();
        } catch (IOException e) {
            //TODO
            e.printStackTrace();
        }
    
        return dataArray;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm very new regarding developing apps for android. Now what I want to do
I am fairly new at developing for Android and was hoping to get some
I'm quite new to developing Android apps. Basically I'm making a webview template to
I am fairly new to developing android apps. What I am trying to do
I'm new to developing apps in Android. We are currently creating a robot using
I am new in developing android applications. I want to create an android application(using
I am new to developing android apps. I am making an app where simple
I'm pretty new to developing Android applications but I am attempting to display the
I'm new on Android developing. I'm trying to manage gps location between activity. In
I'm very new to developing apps to android, so bear with me. Having said

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.