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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T13:18:20+00:00 2026-06-01T13:18:20+00:00

Help!! I have a listadapter with a detail view, the problem that I am

  • 0

Help!!

I have a listadapter with a detail view, the problem that I am having is trying to pass values from an xml file to the second view. I can currently do this but only if I show those values in the first view. What I am trying to acheive is on the firstview have just a title and when you click on that title it takes you to a detail view with more information about it.

here is the code that I currently have.

ListAdapter adapter = new SimpleAdapter(this, menuItems,
            R.layout.list_item,
            new String[] { KEY_USERADDRESS, KEY_DATEDUE}, new int[] {
                    R.id.name, R.id.cost });
    setListAdapter(adapter);

    // selecting single ListView item
    ListView lv = getListView();

    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)).getText().toString();
            String cost = ((TextView)view.findViewById(R.id.cost)).getText().toString();
        //  String description = ((TextView) view.findViewById(R.id.desciption)).getText().toString();

            // Starting new intent
            Intent in = new Intent(getApplicationContext(), SingleMenuItemActivity.class);
            //in.putExtra(KEY_USERADDRESS, name);
            in.putExtra(KEY_DATEDUE, cost);
            //in.putExtra(KEY_DESC, description);
            startActivity(in);

        }
    });
}

As you can see I have a list adapter,I only want to show the contents of the KEY_USERADDRESS on the first view and when they click it then the rest will be shown. If I add the rest of the Textviews to the listadapter it makes the textviews to big.

Sorry if I am a little confusing, I’m still a rookie when it comes to android development.

Any help will be appreciated!!

  • 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-01T13:18:21+00:00Added an answer on June 1, 2026 at 1:18 pm

    Assuming your data is stored in the menuItems Map object, how about something like this in your onItemClick():

    public void onItemClick(AdapterView<?> parent, View view,
                int position, long id) {
        //Your code here..
        Map<String, String> myValueMap = menuItems.get(position);
    
        // Starting new intent
        Intent in = new Intent(getApplicationContext(), SingleMenuItemActivity.class);
        in.putExtra(KEY_USERADDRESS, myValueMap.get(KEY_USERADDRESS));
        in.putExtra(KEY_DATEDUE, myValueMap.get(KEY_DATEDUE));
        in.putExtra(KEY_DESC, myValueMap.get(KEY_DESC));
        startActivity(in);
    }
    

    the position parameter in the onItemClick can be used to get the selected Map from your menuItems which you used the create your SimpleAdapter to populate the ListView

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

Sidebar

Related Questions

I have help.html file in resource directory. I can open it from Eclipse these
My application is fetching data from a Xml file on a webpage. That date
I'm trying to have 'help' tooltips which appear when you click on labels of
Can I have some help in improving this linq. I'm basically returning speakers from
I have an HTML help system that I need to convert to SharePoint. The
I currently have a simple list view adapter that holds two rows of text.
I have help file help.hap I add him to app by typing his name
would it would help to have the apikey linked to an account that also
I downloaded JEDIVCL package.... according to its help i have to run install.bat from
Please help I have 3 ImageViews and I can move that 3 views with

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.