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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T16:34:51+00:00 2026-06-02T16:34:51+00:00

Ive created a custom adpater for my list view aswell as having created my

  • 0

Ive created a custom adpater for my list view aswell as having created my custom dialog with a list view in it but i have no idea how to link the data into the listview in the custom dialog (im doing a really bad job of explaining this i know). My adapter uses a listview that has checkbox’s and i would like to know how im able to store if there checked or not for the next time the application is open.
I’ll put it into steps so its not so confusing:
I want to:
Create a list view with my adapter inside my existing custom dialog,
Store the state of the checkbox’s for the next time the application is open.

(its not shown but my listview is called listviewdialog)

My main activity (just the custom dialog bit)

button = (Button) findViewById(R.id.button01);

    // add button listener
    button.setOnClickListener(new OnClickListener() {

      public void onClick(View arg0) {

        // custom dialog
        final Dialog dialog = new Dialog(context);
        dialog.setContentView(R.layout.list);
        dialog.setTitle("The List");


        // set the custom dialog components - text, image and button
        TextView text = (TextView) dialog.findViewById(R.id.TextView01);
        text.setText("Did you not read the button? :P i'm not finshed on this yet XD");


        Button dialogButton = (Button) dialog.findViewById(R.id.Button01);
        // if button is clicked, close the custom dialog
        dialogButton.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                dialog.dismiss();
            }
        });

        dialog.show();
      }
    });

My Custom Adapter:

package kevin.erica.box;

import kevin.erica.box.R;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.CheckBox;
import android.widget.ImageView;
import android.widget.TextView;

public class MobileArrayAdapter extends ArrayAdapter<String> {
private final Context context;
private final String[] values;

public MobileArrayAdapter(Context context, String[] values) {
    super(context, R.layout.list_adapter, values);
    this.context = context;
    this.values = values;
}

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    LayoutInflater inflater = (LayoutInflater) context
            .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View rowView = inflater.inflate(R.layout.list_adapter, parent, false);
    CheckBox textView = (CheckBox) rowView.findViewById(R.id.checkBox1);
    textView.setText(values[position]);



    return rowView;
}
 }
  • 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-02T16:34:54+00:00Added an answer on June 2, 2026 at 4:34 pm

    In the part where you set up your dialog:

    String[] mData;
    // get your data; I don't know where its coming from
    MobileArrayAdapter mAdapter = new MobileArrayAdapter(getContext(), mData);
    ListView mListView = (ListView) dialog.findViewById(R.id.listviewdialog);
    mListView.setAdapter(mAdapter);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a custom control ive created that is instanced in my view, in
Im created a custom block, with the below code, but im having some trouble
Hi I've been having some trouble trying to get a list view I created
I've created a custom view class and right now just want to draw an
I've created a custom module citation for academic references. Citations have, among other things,
I've created custom button derived from a normal .Net button and have added the
I've created a custom component that display some data to the page according to
Overview: I have an Expandable List View which displays items of the type ToDoElement
Ive created a custom UserControl that contains a single combobox. The currently selected value
How would I use a list in this custom dialogue? ive set a list

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.