package com.ulfbenjaminsson.spaceshootersample
import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.widget.Button
import android.widget.TextView
private const val TAG = "MainActivity"
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
findViewById<Button>(R.id.startGameButton)?.setOnClickListener {
val intent = Intent(this, GameActivity::class.java)
startActivity(intent)
}
}
override fun onResume() {
super.onResume()
val prefs = getSharedPreferences(PREFS, MODE_PRIVATE)
val longestDistance = prefs.getInt(LONGEST_DIST, 0)
val highscore = findViewById<TextView>(R.id.highscore)
highscore.text = "Longest distance: $longestDistance km"
}
}
Comments
0 B
|👍
/👎
0 B
|👍
/👎
0 B
|👍
/👎