Skip to content

Commit

Permalink
Update AndroidX SCAN Intent sample
Browse files Browse the repository at this point in the history
  • Loading branch information
markusfisch committed Mar 3, 2024
1 parent 0d4f536 commit 3ec43da
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,12 @@ If you're using AndroidX, this would be the new,
[recommended way][intent_result]:

```kotlin
class YourActivity : Activity() {
private val resultLauncher = registerForActivityResult(StartActivityForResult()) { result ->
if (result.resultCode == Activity.RESULT_OK) {
val scan = result.data?.getStringExtra("SCAN_RESULT")
class YourActivity : AppCompatActivity() {
private val resultLauncher = registerForActivityResult(
ActivityResultContracts.StartActivityForResult()
) { result ->
if (result.resultCode == RESULT_OK) {
val content = result.data?.getStringExtra("SCAN_RESULT")
}
}
Expand Down

0 comments on commit 3ec43da

Please sign in to comment.