1

I got a listView with the values 1000 to 9000 (1000 a step). My idea is that the user should pick one item from the list and than press the start button. The chosen item will be displayed in the editText. After the user pressed the start button the editText will take the following listItem item as value every second until the user presses the cancel button.

So if the user for example choses 3000 and than press start, the editText should state 3000, and increment by 1000 every second (taking over the next listItem).

Idea how it should be: Preview

Community
  • 1
  • 1
  • Is this because of grammar or sentence construction, the question doesn't make much sense. – Pankaj Nimgade Feb 12 '16 at 12:29
  • Only first choice should be random, and than cycle trough the list starting with that random item? or should it be a random list item every second? – Strider Feb 12 '16 at 12:33
  • The 'ListView' is displayed with 'value' starting from '1000 to 9000'. If user select 1000 value and click on start button then the 'EditText' after delay of 1 sec autochoose 2000 'value' then 3000 'value' then 4000 value in 'EditText' from given 'ListView' value list. – user3749720 Feb 12 '16 at 12:40
  • Sorry my edit wasn't correct. I have changed it. please correct me if I didn't get your question quite right. – Strider Feb 12 '16 at 12:47

1 Answers1

1

My approach to get done would be

1) Generate random number between 0 & adapter count.Generate Random number

2) Write method to access text from adapter on basis of random number

3) For counties lopping use Handler run Handler till user press

e.g Handler

handler = new Handler();

final Runnable r = new Runnable() {
    public void run() {
       if(!userClcikedCancel){
            handler.postDelayed(r, 1000);
            // get text from adapter and set to EditText     
       }
    }
};

handler.postDelayed(r, 1000);
Community
  • 1
  • 1
N J
  • 27,217
  • 13
  • 76
  • 96