Skip to content

Latest commit

 

History

History
43 lines (38 loc) · 1.07 KB

README.md

File metadata and controls

43 lines (38 loc) · 1.07 KB

Inline Activity Result

Android library written in Kotlin to simplify starting activities for result.

Setup

Add the JitPack repository to your build file

allprojects {
  repositories {
    ...
    maven { url 'https://jitpack.io' }
  }
}

Add library dependency to your project build file

dependencies {
  implementation 'com.github.cregus:inline-activity-result:1.0'
}

Sample usage

startActivityForResult functions can be started from FragmentActivity or Fragment.

Starting activity using intent.

startActivityForResult(intent) { result ->
    if (result.isOk()) {
        val resultIntent = result.intent
        // Do something with result intent.
    }
}

Starting activity with extras and listening for only OK result code.

val extras = Bundle()
extras.putInt("ID", 1)
startActivityForResultOk<SampleActivity>(extras) { result ->
    val resultIntent = result.intent
    // Do something with result intent.
}