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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:17:19+00:00 2026-05-23T13:17:19+00:00

I am looking at creating a Dialog with a bundle of data . This

  • 0

I am looking at creating a Dialog with a bundle of data. This all work correctly.
I have a number of buttons when clicked opens the dialog with the data and can then be updated.

Trouble I am having is it does not matter which button I press the bundle is only the data for the last row. Any ideas on getting the correct data passed to the Dialog for each button.

I was thinking down the line of setting an id for each view as I pass through the loop but unsure how to call that back again

Code:

for (int i = 0; i < nameInfo.size(); i++) {
            // creating the views
            View viewItem = (View) inflater.inflate(R.layout.view_item, null);
            nameView = (TextView) viewItem.findViewById(R.id.title);
            nameView.setId(i);
            value1View = (TextView) viewItem.findViewById(R.id.value1);
            value1View.setId(i);
            value2View = (TextView) viewItem.findViewById(R.id.value2);
            value2View.setId(i);

            updateButton = (Button) sightmarkView.findViewById(R.id.updatebutton);
            updateButton.setId(i);
            // Getting the values
            nameValue = nameInfo.get(i).toString();
            value1 = db.getvalue1('1', nameInfo.get(i).toString());
            value2 = db.getvalue2('2', nameInfo.get(i).toString());
            // update fields
            nameView.setText(nameValue);
            value1View.setText(String.valueOf(value1));
            value2View.setText(String.valueOf(value2));

            updateButton.setOnClickListener(new View.OnClickListener() {
                public void onClick(View v) {


                    int updateButtonId = updateButton.getId();

                                bundle = new Bundle();
                                bundle.putString("name", nameValue);
                            bundle.putFloat("value1", value1);
                                bundle.putFloat("value2", value2);

                                showDialog(SIGHTMARK_DIALOG_ID, bundle);

                }
            });
        pMainlayout.addView(viewItem);
}

Thanks for your time

  • 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-23T13:17:20+00:00Added an answer on May 23, 2026 at 1:17 pm

    In each loop (from the for), you are redefining the values of nameValue, value1 and value2.

    To fix the problem, just change your code to match this:

    // Getting the values
    final String nameValue = nameInfo.get(i).toString();
    final String value1 = db.getvalue1('1', nameInfo.get(i).toString());
    final String value2 = db.getvalue2('2', nameInfo.get(i).toString());
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am looking into creating type-safe generic controls. This is targeting the (reduced) generics
I have been looking into different systems for creating a fast cache in a
I have a jQuery UI Dialog box, that I'm creating. It starts out as
Anyone have any experience creating a modal dialog box using AJAX and ASP.NET MVC?
I am looking at creating a small class generator for a project. I have
I have been looking into creating a signature on the OAuth site & over
I am looking at creating a navigation menu similar in style to Very.co.uk Can
I'm looking at creating a panel that takes all the children and wraps them
I am looking into creating a global ID system for all of our online
I'm creating an android app. I have a Dialog, and I want to handle

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.