https://kotlinlang.org
Join Slack
What's the difference between DataSource and Repository?
c

chanjungskim

about 2 years ago
What's the difference between DataSource and Repository?
c
r
d
  • 3
  • 6
  • 1946
What’s the right way to handle `onNewIntent()` when using Compose Navigation? My use case is similar...
c

Chris Fillmore

almost 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
  • 1946
what does this error means? ```Reading a state that was created after the snapshot was taken or in a...
m

Marko Novakovic

over 4 years ago
what does this error means?
Reading a state that was created after the snapshot was taken or in a snapshot that has not yet been applied
m
c
c
  • 3
  • 7
  • 1937
I have this task in my `build.gradle` ```compileKotlin { kotlinOptions { jvmTarget = Jav...
v

Vitali Plagov

over 2 years ago
I have this task in my
build.gradle
compileKotlin {
    kotlinOptions {
        jvmTarget = JavaVersion.VERSION_11
    }
}
The IDEA warns me that
kotlinOptions
is deprecated. I can’t find the option how to replace this with a proper syntax. Can anyone please help me? Gradle 7.2, Kotlin 1.8.0
v
m
+5
  • 7
  • 54
  • 1926
how can we retain scroll position of `LazyColumn` when navigating from screen A to screen B and comi...
d

Danish Ansari

over 3 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
  • 1905
How can I collect a flow in swift using KMM?
h

Hossein Amini

about 4 years ago
How can I collect a flow in swift using KMM?
h
m
+2
  • 4
  • 4
  • 1898
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
  • 1879
Hey! Is it possible to run ktlint only on a given set of files? Eg: Something like `./gradlew ktlint...
g

GurpreetSK

almost 6 years ago
Hey! Is it possible to run ktlint only on a given set of files? Eg: Something like
./gradlew ktlint {list of files}
?
g
a
  • 2
  • 4
  • 1874
The `combineLatest` operator is deprecated for flows. Is there a way to achieve similar results with...
s

Saurabh

about 5 years ago
The
combineLatest
operator is deprecated for flows. Is there a way to achieve similar results with some other api in flow?
s
a
+2
  • 4
  • 4
  • 1873
How to show an emptyView with no items in compose paging. It seems impossible. We have to skip the c...
m

myanmarking

over 3 years ago
How to show an emptyView with no items in compose paging. It seems impossible. We have to skip the condition for initial load (which the itemCount == 0). Also we cannot rely on endOfPaginationReached because the page can load from any position. Why is this api so hard ?
m
f
+3
  • 5
  • 12
  • 1864
Previous91011Next

kotlinlang

A modern programming language that makes developers happier.

Powered by