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

  • Home
  • SEARCH
  • 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 7903005
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T09:38:47+00:00 2026-06-03T09:38:47+00:00

I am using XML parser.In that i have to pass one id from one

  • 0

I am using XML parser.In that i have to pass one id from one activity to other ,but this id is not shown in textview of the 1st screen.How can i pass this id to other screen.

Here is my code:

            XMLParser parser = new XMLParser();
        String xml = parser.getXmlFromUrl(URL); // getting XML
        Document doc = parser.getDomElement(xml); // getting DOM element

        NodeList nl = doc.getElementsByTagName(KEY_ITEM);
        // looping through all item nodes <item>
        for (int i = 0; i < nl.getLength(); i++) 
        {
            // creating new HashMap
            HashMap<String, String> map = new HashMap<String, String>();
            Element e = (Element) nl.item(i);
            // adding each child node to HashMap key => value
            map.put(KEY_ID, parser.getValue(e, KEY_ID));
            map.put(KEY_NAME, parser.getValue(e, KEY_NAME));
            map.put(KEY_LASTVALUE,parser.getValue(e, KEY_LASTVALUE));
            map.put(KEY_CHANGE, parser.getValue(e, KEY_CHANGE));
            map.put(KEY_STKEXCHANGE, parser.getValue(e, KEY_STKEXCHANGE));  
            map.put(KEY_LASTPRICE, parser.getValue(e, KEY_LASTPRICE));  

            // adding HashList to ArrayList
            menuItems.add(map);
        }

Here i have to pass the id on clicking the particular element value,how can i do it:

lv.setOnItemClickListener(new OnItemClickListener() 
        {
            @Override
            public void onItemClick(AdapterView<?> parent, View view,
                    int position, long id) {
                // getting values from selected ListItem
//              String name = ((TextView) view.findViewById(R.id.name_label)).getText().toString();
//              String cost = ((TextView) view.findViewById(R.id.cost_label)).getText().toString();
//              String description = ((TextView) view.findViewById(R.id.description_label)).getText().toString();
                // Starting new intent
                Intent in = new Intent(getApplicationContext(), IndicesDetails.class);
//              in.putExtra(KEY_STKEXCHANGE, name);
//              in.putExtra(KEY_COST, cost);
//              in.putExtra(KEY_DESC, description);
//              string ids = getItemId(position);               
//              in.putExtra("idvalue", id);
                startActivity(in);

            }
        });
  • 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-03T09:38:48+00:00Added an answer on June 3, 2026 at 9:38 am

    In Current Activity :

     public void onItemClick(AdapterView<?> parent, View view,
                        int position, long id) {
                    // Starting new intent
                    Intent in = new Intent(getApplicationContext(), IndicesDetails.class);              
                    in.putExtra("idvalue", id);
                    startActivity(in);
                }
    

    Then in the new activity, retrieve those values:

    Bundle extras = getIntent().getExtras();
    if(extras !=null) {
    long value = extras.getLong("idvalue");
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string that I have parsed from XML using Google's GDataXML parser,
I have student.xml file and am parsing this file using SAX Parser and now
I have built one 'deep' NSMutableDictionary that contains parsed XML data along with other
I have created an application, using ARC, that parses data from an online XML
I currently have a Perl CGI script that parses incoming XML requests using XML::Simple
I have some XML that I want to parse using the lxml method in
I am using DOM parser to parse xml data, but its taking lots of
I have a problem with using the SAX parser to parse a XML file.
I'm parsing data from an xml file using WebClient. In DownloadStringCompleted method I have
I have some xml that looks like this: <rootElement attribute=' > '/> This is

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.