https://kotlinlang.org
Join Slack
I keep getting unresolved reference for `rememberNavController()` et all on Android Studio EEL. Any...
l

Love Otudor

over 2 years ago
I keep getting unresolved reference for
rememberNavController()
et all on Android Studio EEL. Any ideas on how to fix this? I have Updated dependencies
l
j
  • 2
  • 7
  • 2175
Hi! I'm noticing different behavior around the `import-ordering` rule between ktlint and ktlint-grad...
v

Vince

about 4 years ago
Hi! I'm noticing different behavior around the
import-ordering
rule between ktlint and ktlint-gradle (gradle wrapper). Specifically around the ordering of java/javax/kotlin and aliases: ktlint 0.42.1
Imports must be ordered in lexicographic order without any empty lines in-between with "java", "javax", "kotlin" and aliases in the end
JLLeitschuh/ktlint-gradle wrapper 10.2.0 using ktlint 0.42.1
Imports must be ordered in lexicographic order without any empty lines in-between (import-ordering)
Any idea what could be causing this discrepancy? The gradle wrapper `ktlintCheck`/`ktlintFormat` tasks aren't respecting the latter part of the rule around java/javax/kotlin + alias imports going at the end. Seems to have been added into ktlint around 0.42 based on some closed issues in the repo.
v
s
r
  • 3
  • 5
  • 2155
What’s the right way to handle `onNewIntent()` when using Compose Navigation? My use case is similar...
c

Chris Fillmore

over 4 years ago
What’s the right way to handle
onNewIntent()
when using Compose Navigation? My use case is similar to e.g. OAuth authorization flow. I am redirecting back to an Activity via <intent-filter>, and starting the Activity with SINGLE_TOP. There will be a route in the new Intent, which I want to navigate to. Has anyone handled something like this? Here’s some dummy code example of what I mean:
class MyActivity {
  
  fun onCreate() {
    setContent { MyApp() }
  }

  fun onNewIntent(intent: Intent) {
    val route = intent.getStringExtra("redirect_route")
    ?? What to do with 'route'
  }
}

@Composable
fun MyApp() {
  val navController = rememberNavController()
  MyNavHost(navController)
}

@Composable
fun MyNavHost(controller: NavController) {
  NavHost(...) {
    ... define routes ...
  }
}
c
a
i
  • 3
  • 15
  • 2148
how can we retain scroll position of `LazyColumn` when navigating from screen A to screen B and comi...
d

Danish Ansari

almost 4 years ago
how can we retain scroll position of
LazyColumn
when navigating from screen A to screen B and coming back Screen A contains 20 items, user scrolled to 15th item, selected 15th item, Screen B opened, came back, list gets reset, scrolled to 1st item But I want the 15th item to be visible
d
a
t
  • 3
  • 24
  • 2143
is there a problem using `ConcurrentHashMap` with coroutines? I see 2 potential issues, assuming th...
y

Yoavya

over 3 years ago
is there a problem using
ConcurrentHashMap
with coroutines? I see 2 potential issues, assuming that I want to compute a value
computeIfAbsent
. I don’t think using
getOrPut
is an option since it is not concurrent and the value may already exist: 1. If my compute function is suspending (can be
runBlocking
with parallel computation to speed the process) then another coroutine (on the same thread) can run the same
synchronized
code. I think that is a problem 2. If I am running on a dispatcher that runs multiple threads and my compute function is suspending again then I can find myself waking up in a different thread then the one that I started in (can that happen?). Will it break the synchronized block inside the
ConcurrentHashMap
? I am not sure what happens here. Is there anything that is coroutine safe equivalent to
ConcurrentHashMap
or do you know if there is something planned to solve these issues? (if what I described are issues)
y
r
+2
  • 4
  • 50
  • 2140
what is the difference between `bootJar` and `shadowJar` . Can I use `shadowJar` for Spring boot app...
s

Sourabh Rawat

over 5 years ago
what is the difference between
bootJar
and
shadowJar
. Can I use
shadowJar
for Spring boot applications?
s
d
m
  • 3
  • 8
  • 2140
Is it possible to specify the padding amount as a percentage of a composable’s width/height?
j

julioromano

over 3 years ago
Is it possible to specify the padding amount as a percentage of a composable’s width/height?
j
z
  • 2
  • 14
  • 2130
Is it possible to go from a Color to a hex value? i.e. I have some colors defined, but I want to pr...
c

Colton Idle

over 4 years ago
Is it possible to go from a Color to a hex value? i.e. I have some colors defined, but I want to print out the hex value on top of the color for debugging so it would be nice to just be able to reference the Color and get the hex value.
c
a
+2
  • 4
  • 8
  • 2129
Are `sealed class` really not supported yet on Android? ```{"kind":"error","text":"com.android.tools...
c

CLOVIS

almost 3 years ago
Are
sealed class
really not supported yet on Android?
{"kind":"error","text":"com.android.tools.r8.internal.Jc: Sealed classes are not supported as program classes","sources":[{"file":"[PATH REDACTED]/NavigationMenu.class"}],"tool":"D8"}
c
m
+4
  • 6
  • 11
  • 2123
I am getting a following error message during the UI tests when I test it with `onNodeWithText` , bu...
k

K Merle

almost 3 years ago
I am getting a following error message during the UI tests when I test it with
onNodeWithText
, but I'm not sure what's causing 2 nodes to be found. 🧵
k
s
  • 2
  • 5
  • 2112
Previous8910Next

kotlinlang

A modern programming language that makes developers happier.

Powered by