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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T21:08:49+00:00 2026-05-23T21:08:49+00:00

I don’t really know where to begin asking this question, so I’ll just try

  • 0

I don’t really know where to begin asking this question, so I’ll just try to describe my problem the best I can…I’m currently working on a ListView with a custom List Adapter that inflates 2 text Views and a checkBox. One textView is a description of the option, where the other textView is saved for when I need to use it to display data. When a user clicks on an item in the List it will pop up with an editText Dialog box. I got it to save the text and display it, but the problem I’m having is that when it displays the data, it’s not on the correct ListView item… for example: http://www.vbsteven.be/blog/wp-content/uploads/2009/07/screenshotcalllog.png
Say if I wanted to display the information I got from my dialog box in the first slot of the listView. It displays randomly in either the 3rd 2nd or 4th positions. This seems like such a simple problem but I’ve been struggling for a while…

xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:orientation="vertical"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent">

  <TextView android:id="@+id/rowTextView" 
    android:layout_width="wrap_content" 
    android:layout_height="70dp"
    android:padding="12dp"
    android:textSize="16sp" >
  </TextView>

  <TextView android:id="@+id/alarm_name_text" 
   android:layout_height="wrap_content" 
   android:text="" 
   android:layout_toRightOf="@+id/rowTextView" 
   android:layout_width="fill_parent">
   </TextView>

  <CheckBox android:id="@+id/CheckBox01" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:padding="10dp"
    android:layout_alignParentRight="true" android:layout_marginRight="6sp"
    android:focusable="false">
  </CheckBox>

</RelativeLayout>

Activity:

    @Override
    protected Dialog onCreateDialog(int id) {
        switch (id) {
        case DIALOG_TEXT_ENTRY:

            LayoutInflater mInflater = LayoutInflater.from(this);
            final View textEntryView = mInflater.inflate(
                    R.layout.alert_text_entry, null);
            /*final View textEntryView1 = mInflater.inflate(R.layout.row, null);*/
            final EditText savedText = ((EditText)textEntryView.findViewById(R.id.password_edit));
            final TextView rowSavedText = ((TextView)findViewById(R.id.alarm_name_text));
            return new AlertDialog.Builder(AlarmList.this)
                    .setIcon(R.drawable.alert_icon)
                    .setTitle("Enter your name")
                    .setView(textEntryView)
                    .setPositiveButton("accept",
                            new DialogInterface.OnClickListener() {
                                @Override
                                public void onClick(DialogInterface dialog,
                                        int which) {
                                    String temp = savedText.getText().toString();
                                    rowSavedText.setText(temp);
                                    rowSavedText.setVisibility(0);
                                }
                            })
                    .setNegativeButton("Cancel", new OnClickListener() {
                        public void onClick(DialogInterface dialog, int which) {

                        }
                    }).create();
        }
        return null;
    }

If anyone wants to see any other part of my code for helping, please let me know. Thanks in advance!

Heres my list Adapter and data in it :

planets = new Planet[] { new Planet("Turn On Alarm"),
                    new Planet("Alarm Name"), new Planet("Time"),
                    new Planet("Sound"), new Planet("Vibrate"),
                    new Planet("Repeat"), new Planet("Volume Control"),
                    new Planet("Second Alarm") };
        }
        ArrayList<Planet> planetList = new ArrayList<Planet>();
        planetList.addAll(Arrays.asList(planets));


listAdapter = new PlanetArrayAdapter(this, planetList);

/** Custom adapter for displaying an array of Planet objects. */
private class PlanetArrayAdapter extends ArrayAdapter {

    private LayoutInflater inflater;
    public PlanetArrayAdapter(Context context, List<Planet> planetList) {
        super(context, R.layout.row, R.id.rowTextView, planetList);

        // Cache the LayoutInflate to avoid asking for a new one each time.
        inflater = LayoutInflater.from(context);

    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        // Planet to display
        Planet planet = (Planet) this.getItem(position);


        // The child views in each row.
        CheckBox checkBox;
        TextView textView;
        Spinner mySpinner;


// Create a new row view
            if (convertView == null) {
                convertView = inflater.inflate(R.layout.row, null);

                // Find the child views.
                textView = (TextView) convertView
                        .findViewById(R.id.rowTextView);
                checkBox = (CheckBox) convertView.findViewById(R.id.CheckBox01);
                // Optimization: Tag the row with it's child views, so we don't
                // have to
                // call findViewById() later when we reuse the row.
                convertView.setTag(new PlanetViewHolder(textView, checkBox));

                // If CheckBox is toggled, update the planet it is tagged with.
                checkBox.setOnClickListener(new View.OnClickListener() {
                    public void onClick(View v) {
                        CheckBox cb = (CheckBox) v;
                        Planet planet = (Planet) cb.getTag();
                        planet.setChecked(cb.isChecked());
                    }
                });
            }
            // Reuse existing row view
            else {
                // Because we use a ViewHolder, we avoid having to call
                // findViewById().
                PlanetViewHolder viewHolder = (PlanetViewHolder) convertView
                        .getTag();
                checkBox = viewHolder.getCheckBox();
                textView = viewHolder.getTextView();
            }

            // Tag the CheckBox with the Planet it is displaying, so that we can
            // access the planet in onClick() when the CheckBox is toggled.
            checkBox.setTag(planet);

            // Display planet data
            checkBox.setChecked(planet.isChecked());
            textView.setText(planet.getName());

            return convertView;
        }
  • 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-23T21:08:50+00:00Added an answer on May 23, 2026 at 9:08 pm

    Don’t think you can set those textviews from the dialog view. You will have to set them from within your custom list adapter. Get the name from dialog like you are doing, then add the name to your custom adapter’s data set and finally set the adapter again or notifyDataSetChanged().

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

Sidebar

Related Questions

I don't know how better to describe this. So take this example. var a
Don't know if this is an eclipse specific problem but whenever I declare a
Don't know why but I can't find a solution to this. I have 3
Don't let below code scare you away . The question is really simple, only
Don't be scared of the extensive code. The problem is general. I just provided
Don't dismiss this as a newbie question! It's not, I'm not, I've tried everything,
Don't really know how to formulate the title, but it should be pretty obvious
Don't have much to say, just can get into the event handler. XAML: <Grid>
Don't know if this is the right place to ask this, but I will
Don't know what to do with this error. How to add data in SQL

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.