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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T20:29:58+00:00 2026-05-30T20:29:58+00:00

I have List of Checkboxes which i want to create using FOR LOOP .

  • 0

I have List of Checkboxes which i want to create using FOR LOOP.

I have following type of data.

Value 1  --> checkbox image
Value 2  -->
Value 3  -->
.
.
.
Value 15 --> checkbox Image

I am using following code for that but not getting how will it work??? Is it correct code??

var chkArray = ['Value 1', 'Value 2', 'Value 3', 'Value 4', 'Value 5', 'Value 6', 'Value 7', 'Value 8', 'Value 9', 'Value 10'];

AssessmentArray = function createChkBx() {
    var chkBx = [];
    for(var i in chkArray) {
        var t = 80;
        var checkbox = Ti.UI.createSwitch({
            style : Ti.UI.Android.SWITCH_STYLE_CHECKBOX,
            title : chkArray[i],
            value : true,
            left : '20dp',
            top : t + 30,
            height : 25,
            width : 'auto'
        });
        checkbox.addEventListener("change", function(e) {
            Ti.API.info("The checkbox has been set to " + e.value);
        });
        chkBx.push(checkbox);   
    }
    return chkBx;
}


var assessData = new AssessmentArray();

Now how should I add this to my Window??? This is specifically for Android only…

  • 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-30T20:30:00+00:00Added an answer on May 30, 2026 at 8:30 pm
    var AssessmentArray = function()
    {
    
         function AssessmentArray ()
         {
    
            //Pass the parent view inside which u want to add the check boxes and teh values as array 
            //gap or the distance between two checkboxes
            this.addCheckBoxes = function(window, values, gap)
            {
                var t = 0;
                var chkBx = [];
                var i = 0;
                for(i = 0; i < values.length; i++) {
    
                    var checkbox = Ti.UI.createSwitch({
                        style : Ti.UI.Android.SWITCH_STYLE_CHECKBOX,
                        title : chkArray[i],
                        value : true,
                        left : '20dp',
                        top : i * gap,
                        height : 25,
                        width : 'auto'
                    });
                    checkbox.addEventListener("change", function(e) {
                        Ti.API.info("The checkbox has been set to " + e.value);
                    });
                    win.add(checkbox);
                    chkBx.push(checkbox);
                }
                return chkBx;
            }
    
    
    
         }
    
        return AssessmentArray;
    }();
    
    var ass = new AssessmentArray();
    ass.addCheckBoxes(Ti.UI.createWindow(), ['Value 1', 'Value 2', 'Value 3', 'Value 4', 'Value 5', 'Value 6'], 50);
    

    try some thing like this.

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

Sidebar

Related Questions

I have the following sample code which gets a list of values from a
I have a list of variable length and want to create a checkbox (with
I am trying to implement image as checkbox. I have a list with 2
I have List I want to sort Desc by Priority, which is int and
I have a list of checkboxes that I want to insert into a database,
Using MVC3 I am trying to accomplish the following. I have a table which
The first time the app is run, I want to have a checkbox list
I have created a dynamic listview which contains a CheckBox.what I want is at
I currently have a list of checkboxes all with the same ID which are
I have an list of checkboxes on a GWT widget using Gwittir . I

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.