Skip to content

Instantly share code, notes, and snippets.

View wise4rmgod's full-sized avatar
💻
Working from home

Nwokocha Wisdom Maduabuchi wise4rmgod

💻
Working from home
View GitHub Profile
val ty=packageManager.getLaunchIntentForPackage("com.andelasurvey.smithnwokocha.newtestme")
startActivity(ty)
@wise4rmgod
wise4rmgod / gist:ecd115a49433bf9866e13e7d60a37c67
Created October 25, 2020 21:11
Column in jetpack compose
@Composable
fun ColumnExample() {
Column {
Text("Hello World!")
Text("Hello World!2")
}
}
@Composable
fun TextExample() {
Text {
Text("Hello World!")
}
}
@Composable
fun ButtonExample() {
Button(onClick = { /* Do something! */ },backgroundColor = Color.Red) {
Text("Button")
}
}
@Composable
fun TextFieldDemo() {
val textState = remember { mutableStateOf(TextFieldValue()) }
TextField(
value = textState.value,
onValueChange = { textState.value = it }
)
}
}
@Composable
fun BoxExample() {
Box(Modifier.fillMaxSize()) {
Text("This is first text", modifier = Modifier.align(Alignment.TopCenter))
Box(
Modifier.align(Alignment.TopCenter).fillMaxHeight().preferredWidth(
50.dp
).background( Color.Blue)
)
Text("This is second text", modifier = Modifier.align(Alignment.Center))
The following assertion was thrown during a scheduler callback:
There are multiple heroes that share the same tag within a subtree.
Within each subtree for which heroes are to be animated (i.e. a PageRoute subtree), each Hero must have a unique non-null tag.
In this case, multiple heroes had the following tag: Test
Here is the subtree for one of the offending heroes: Hero
class Solution {
fun findMaxConsecutiveOnes(nums: IntArray): Int {
var current = 0
var largest = 0
for (u in nums) {
if (u == 0) {
current = 0
} else {
current++
}
class Solution {
fun findNumbers(nums: IntArray): Int {
var count = 0
for (u in nums) {
val numlength = u.toString().length
if (numlength % 2 == 0) count++
}
return count
}
}
fun sockMerchant(n: Int, ar: Array<Int>): Int {
val mapval = ar.groupBy { it }.mapValues { it.value.count() }
var sock_count = 0
for (u in mapval) {
if (u.value >= 2) {
sock_count += u.value / 2
}