-
Notifications
You must be signed in to change notification settings - Fork 0
/
help.kt
42 lines (30 loc) · 1.21 KB
/
help.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package com.example.lamestimate
import android.content.Intent
import android.net.Uri
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.widget.Button
// ============ HELP ACTIVITy ============
class help : AppCompatActivity() {
fun goTo(url: String){
// https://stackoverflow.com/questions/5026349/how-to-open-a-website-when-a-button-is-clicked-in-android-application
val uriUrl = Uri.parse(url)
val launchBrowser = Intent(Intent.ACTION_VIEW, uriUrl)
startActivity(launchBrowser)
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_help)
// Connect items from help activity
var goback_button = findViewById<Button>(R.id.goback_button)
var readme_button = findViewById<Button>(R.id.readme_button)
// Set up listeners for buttons
goback_button.setOnClickListener{
val intent = Intent(this@help, MainActivity::class.java)
startActivity(intent)
}
readme_button.setOnClickListener {
goTo("https://github.com/Adri6336/Lam-Estimate/blob/main/README.md")
}
}
}