Back to project page Memory-Training-Android-Application.
The source code is released under:
MIT License
If you think the Android project Memory-Training-Android-Application listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package markqdavenport.net.memorizingexercise; //from w w w. j a va2 s .c o m import android.app.Activity; import android.os.Bundle; import android.view.View; import android.widget.EditText; import java.util.Random; /** * Created by mark on 1/2/15. */ public class NumberExercise extends Activity { String currentNumber; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.numbermemorizing); } public void showNumbers(View view) { EditText answerBox = (EditText)findViewById(R.id.answerBox); } public void hideNumbers(View view) { EditText answerBox = (EditText)findViewById(R.id.answerBox); } public void genNumbers(View view) { EditText inputNumber = (EditText)findViewById(R.id.numberOfWords); EditText answerBox = (EditText)findViewById(R.id.answerBox); Random random = new Random(); Integer numberOfNumbers = Integer numberOfNumbers = Integer.parseInt(inputNumber.getText().toString()); String[] randomNumbers = new String[numberOfNumbers]; for(int i = 0; i<numberOfNumbers; i++) { randomNumbers[i] = String.valueOf(random.nextInt(99)); } String displayNumbers = stringArrayToString(randomNumbers); currentNumber = displayNumbers; answerBox.setText(displayNumbers.toString()); } public void Increment(View view) { EditText inputNumber = (EditText)findViewById(R.id.numberOfWords); Integer numberOfNumbers = Integer.parseInt(inputNumber.getText().toString()); numberOfNumbers++; inputNumber.setText(numberOfNumbers.toString()); } public void Decrement(View view) { EditText inputNumber = (EditText)findViewById(R.id.numberOfWords); Integer numberOfNumbers = Integer.parseInt(inputNumber.getText().toString()); numberOfNumbers--; inputNumber.setText(numberOfNumbers.toString()); } public static String stringArrayToString(String[] incomingStringArray) { String temp = ""; for(int p = 0; p<incomingStringArray.length;p++){ temp += " " + incomingStringArray[p] ; } return temp; } }