Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /bbc_download.php on line 73: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /bbc_download.php on line 74: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /bbc_download.php on line 75: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /bbc_download.php on line 76: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /bbc_download.php on line 77: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /bbc_download.php on line 78: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
package android.mathsapp; import java.util.Random; import android.app.Activity; import android.os.AsyncTask; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.TextView; public class MathsAppActivity extends Activity { private String question; private int answer; private TextView questionText, answerAText, answerBText, answerCText, answerDText; private int[] answers = new int[4]; int answerButton; int answerButtonId; private Random r = new Random(); /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); questionText = (TextView) findViewById(R.id.question); answerAText = (Button) findViewById(R.id.answerA); answerBText = (Button) findViewById(R.id.answerB); answerCText = (Button) findViewById(R.id.answerC); answerDText = (Button) findViewById(R.id.answerD); generateQuestion(0); } public void generateQuestion(int delay) { new GenerateQuestion().execute(delay); } private class GenerateQuestion extends AsyncTask { @Override protected Void doInBackground(Integer... params) { try { Thread.sleep(params[0]); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } int type = getRandomInt(1, 4); if(type==1) { // addition generateAdditionQuestion(); } else if(type==2) { // subtraction generateAdditionQuestion(); } else if(type==3) { // multiplication generateAdditionQuestion(); } else { // division generateAdditionQuestion(); } setAnswers(); return null; } protected void onPostExecute(Void unused) { updateScreen(); } } public void generateAdditionQuestion() { int numberA = getRandomInt(1, 1000); int numberB = getRandomInt(1, 1000); question = numberA + " + " + numberB; answer = numberA + numberB; } public void setAnswers() { answerButton = getRandomInt(0,3); switch (answerButton) { case 0: answerButtonId = R.id.answerA; break; case 1: answerButtonId = R.id.answerB; break; case 2: answerButtonId = R.id.answerC; break; case 3: answerButtonId = R.id.answerD; break; } for(int i=0; i<4; i++) { if (answerButton==i) answers[i] = answer; else answers[i] = getRandomInt(answer-getRandomInt(10,100),answer+getRandomInt(10,100)); } } /* * Called when answer is clicked */ public void checkAnswer(View v) throws InterruptedException { new CheckAnswer().execute(v); } private class CheckAnswer extends AsyncTask { @Override protected Void doInBackground(View... params) { Button clickedButton = (Button)params[0]; if (clickedButton.getId()==answerButtonId) { question = "Correct!"; } else { question = "Incorrect!"; } return null; } protected void onPostExecute(Void unused) { updateScreen(); generateQuestion(1000); } } public void updateScreen() { questionText.setText(question); answerAText.setText(Integer.toString(answers[0])); answerBText.setText(Integer.toString(answers[1])); answerCText.setText(Integer.toString(answers[2])); answerDText.setText(Integer.toString(answers[3])); } private int getRandomInt(int min, int max){ if ( min > max ) { throw new IllegalArgumentException("Start cannot exceed End."); } int randomNum = r.nextInt(max - min + 1) + min; return randomNum; } }