Created
November 9, 2018 08:53
-
-
Save socmia/1d94a3a74c796219fa67b5ce4006448a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SegmentView(context: Context, attrs: AttributeSet) : LinearLayout(context, attrs) { | |
init { | |
View.inflate(context, R.layout. segment_button, this); | |
val btnSeg1: Button = findViewById(R.id.button) | |
val btnSeg2: Button = findViewById(R.id.button2) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun toastMe(v: View) { | |
val myToast = Toast.makeText(this, "Toast me clicked", Toast.LENGTH_LONG) | |
myToast.show() | |
} | |
fun countMe(v: View) { | |
val shouldCountTextMe = findViewById<TextView>(R.id.textView) | |
val countStr = shouldCountTextMe.text.toString() | |
var count: Int = Integer.parseInt(countStr) | |
count++ | |
shouldCountTextMe.text = count.toString(); | |
} | |
fun countYou(id: Int){ | |
when(id) { | |
1 -> { | |
Log.d("Loi", "FONT"); | |
} | |
2 -> { | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment