Go Back   Android Forums > Android Development > Application Development
Application Development Dev lounge for our application developers.

Get excited for the Samsung Galaxy S5! Find everything you need and discuss it in our Galaxy S5 Forum!

test: Reply
 
LinkBack Thread Tools
Old January 4th, 2013, 08:31 AM   #1 (permalink)
New Member
Thread Author (OP)
 
Join Date: Jul 2012
Posts: 14
 
Device(s): Galaxy Nexus, TF101, HTC Glacier, Dell Steak 7, Samsung Galaxy S II
Carrier: Not Provided

Thanks: 0
Thanked 1 Time in 1 Post
Default Push button application

Hello, I am trying to figure out how to implement a small project. I have the control logic figured out I am just new to android development to have a full handle on the task at hand.

I have essentially a 5x4 matrix of buttons that I want to at random light up in a randomized time between 6 and 30 seconds between light up.. The person needs to push the button back in to reset it before 5 seconds or a small red X appears over the button. If the person misses more than 3 times the screen flashes red for a second before resetting the red Xs and the count starts over. There is also a reset button that will reset the counts and start over again and a exit button that will bring up a results page that has how many hits and misses and elapsed time. It should also create a small graph that shows the % correct over time.

Any help will be greatly appreciated.

OberSchutze is offline  
Reply With Quote
sponsored links
Old January 7th, 2013, 06:37 AM   #2 (permalink)
New Member
Thread Author (OP)
 
Join Date: Jul 2012
Posts: 14
 
Device(s): Galaxy Nexus, TF101, HTC Glacier, Dell Steak 7, Samsung Galaxy S II
Carrier: Not Provided

Thanks: 0
Thanked 1 Time in 1 Post
Default

Anyone have any ideas? I am still fairly new to software development.
OberSchutze is offline  
Reply With Quote
Old January 11th, 2013, 07:05 AM   #3 (permalink)
New Member
Thread Author (OP)
 
Join Date: Jul 2012
Posts: 14
 
Device(s): Galaxy Nexus, TF101, HTC Glacier, Dell Steak 7, Samsung Galaxy S II
Carrier: Not Provided

Thanks: 0
Thanked 1 Time in 1 Post
Default

Well I figured out the XML part and that is mostly working. Having some small troubles with custom buttons but I can deal with that later. This question revolves around using the java math random function.

I am trying to create two discrete random events, however from what I understand about the random function I have to use an initial seed value of say 5. If my range is 1 to 24 I do not want to have 5 be the first value every time I start the application.

So my question is, can I make say 3 random functions that trigger after each other and use those values as my initial seed value in the random number I want for the first event to trigger?

For example:

Random #1 has a seed value of 5.

Once that triggers the number that is output is the seed variable of Random #2.

Then Random #3 uses the value generated from Random #2 as its seed value to get me a actual random number.

Does that make sense or am I overly complicating it?

Here is some code to hopefully help:
[HIGH]
public class randomgen{
public static void main(String[] args){
Random rand = new Random();
int num1 = rand.nextInt(24);
System.out.println("Generated Random Number between 0 to 24 is : " + num1);
int num2 = rand.nextInt(num1);
System.out.println("Generated Random Number from seed 1 is : " + num2);
int num3 = rand.nextInt(num2);
System.out.println("Generated Random Number from seed 2 is : " + num3);
}
}
[/HIGH]
OberSchutze is offline  
Last edited by OberSchutze; January 11th, 2013 at 07:15 AM.
Reply With Quote
Reply


Go Back   Android Forums > Android Development > Application Development
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 01:26 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.