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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T10:04:13+00:00 2026-06-01T10:04:13+00:00

public class ExpAdapter : BaseExpandableListAdapter { private int seed = 1000; public override View

  • 0
public class ExpAdapter : BaseExpandableListAdapter
{
  private int seed = 1000;

  public override View GetChildView(int groupPosition, int childPosition, bool isLastChild, View convertView, ViewGroup parent)
    {
        if (convertView == null)
        {
            LayoutInflater inflater = (LayoutInflater) context.GetSystemService(Context.LayoutInflaterService);
            convertView = inflater.Inflate(Resource.Layout.inspection_row_2, null);
        }

        int currentID;
        Random randomizer = new Random(seed);

        TextView question = (TextView) convertView.FindViewById(Resource.Id.questionText);
        RadioGroup radio = (RadioGroup) convertView.FindViewWithTag("actionGroup");
        currentID = randomizer.Next(1,101);
        radio.Id = currentID;
        RadioButton pass = (RadioButton) convertView.FindViewWithTag("passed");
        currentID = randomizer.Next(1,101);
        pass.Id = currentID;
        RadioButton fail = (RadioButton) convertView.FindViewWithTag("failed");
        currentID = randomizer.Next(1,101);
        fail.Id = currentID;
        RadioButton correct = (RadioButton)convertView.FindViewWithTag("corrected");
        currentID = randomizer.Next(1,101);
        correct.Id = currentID;
        RadioButton na = (RadioButton)convertView.FindViewWithTag("na");
        currentID = randomizer.Next(1,101);
        na.Id = currentID;

        string[][] items = questions.childItems();
        question.Text = items[groupPosition][childPosition];

        seed++;

        return convertView;
    }
}

Using a breakpoint to step through the above, currentID = 1 throughout execution. The above method gets called repeatedly as MonoDroid creates the child group of controls under the parent group and currentID is ALWAYS = 1. I have also tried creating currentID and randomizer as private static variables within the entire class. Same result.

EDIT: I attempted to create the new Random instances with a seed value that differed for each call to GetChildView. Code is edited above to show how I did that. Still the value of currentID is always = 1. Below is screen shot of information for randomizer in Locals. This information looks the same regardless of what the seed number is. ???

enter image description here

  • 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-01T10:04:15+00:00Added an answer on June 1, 2026 at 10:04 am

    Randomizer is calculated with system time in milliseconds. So, if you call it rapidly, ie in same millisecond, they get seeded with same number, thus resulting in same random number.

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

Sidebar

Related Questions

public class ToolPartGetLists : Microsoft.SharePoint.WebPartPages.WebPart, ICommunicationInterface { private bool _error = false; //......... protected
public class Ex7 { private int fld; private void meth(int val) { fld =
public class Bird { private static int id = 0; private String kind; public
public class upload extends Activity { private static final int CAMERA_REQUEST = 1888; private
public class MyBindingList : BindingList<int> { public MyBindingList() { } private BindingList<int> temp; public
Public Class FooBar { private int _foo; public int Foo { get { return
public class Bird { private static int id = 0; private String kind; public
public class WordDisplay extends Activity { private int level; private int group; private int
public class Sprite { private static final int BMP_COLUMNS = 3; private static final
public class Employee { public static void main(String[] args) { int j=3; staples[] stemp

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.