protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.Main); db = new DbHelper.DbHelper(this); sqliteDB = db.WritableDatabase; seekBar = FindViewById<SeekBar>(Resource.Id.seekBar); txtMode = FindViewById<TextView>(Resource.Id.txtMode); btnPlay = FindViewById<Button>(Resource.Id.btnPlay); btnScore = FindViewById<Button>(Resource.Id.btnScore); seekBar.SetOnSeekBarChangeListener(this); btnPlay.Click += delegate { Intent intent = new Intent(this, typeof(Play)); intent.PutExtra("MODE", getPlayMode()); StartActivity(intent); Finish(); }; btnScore.Click += delegate { Intent intent = new Intent(this, typeof(Score)); StartActivity(intent); Finish(); }; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.Play); Bundle extra = Intent.Extras; if (extra != null) { mode = extra.GetString("MODE"); } db = new DbHelper.DbHelper(this); txtScore = FindViewById <TextView>(Resource.Id.txtScore); txtQuestion = FindViewById <TextView>(Resource.Id.txtQuestion); progressBar = FindViewById <ProgressBar>(Resource.Id.progressBar); imageView = FindViewById <ImageView>(Resource.Id.question_flag); btnA = FindViewById <Button>(Resource.Id.btnAnswerA); btnB = FindViewById <Button>(Resource.Id.btnAnswerB); btnC = FindViewById <Button>(Resource.Id.btnAnswerC); btnD = FindViewById <Button>(Resource.Id.btnAnswerD); btnA.SetOnClickListener(this); btnB.SetOnClickListener(this); btnC.SetOnClickListener(this); btnD.SetOnClickListener(this); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.Score); lstView = FindViewById <ListView>(Resource.Id.lstView); DbHelper.DbHelper db = new DbHelper.DbHelper(this); List <Ranking> lstRanking = new List <Ranking>(); if (lstRanking.Count > 0) { CustomAdapter adapter = new CustomAdapter(this, lstRanking); lstView.Adapter = adapter; } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.Done); DbHelper.DbHelper db = new DbHelper.DbHelper(this); btnTryAgain = FindViewById <Button>(Resource.Id.btnTryAgain); txtTotalQuestion = FindViewById <TextView>(Resource.Id.txtTotalQuestion); txtTotalScore = FindViewById <TextView>(Resource.Id.txtTotalScore); progressBarResult = FindViewById <ProgressBar>(Resource.Id.doneProgressBar); btnTryAgain.Click += delegate { Intent intent = new Intent(this, typeof(MainActivity)); StartActivity(intent); Finish(); }; //Get Data Bundle bundle = Intent.Extras; if (bundle != null) { int score = bundle.GetInt("SCORE"); int totalQuestion = bundle.GetInt("TOTAL"); int correctAnswer = bundle.GetInt("CORRECT"); txtTotalScore.Text = $"SCORE : {score}"; txtTotalQuestion.Text = $"PASSED : {correctAnswer}/{totalQuestion}"; progressBarResult.Max = totalQuestion; progressBarResult.Progress = correctAnswer; //Save score db.InsertScore(score); } }