Android Intent & Bundle extensions that allow you to insert and extract values in an elegant way.

Inclusion in your project



Add the following codes to your build.gradle master file (not to your build.gradle module)

all projects {
repositories {

And insert the dependency code into your module’s build.gradle file.

Dependencies { Implementation



IntentOf is an expression to create an Intent with Kotlin’s DSL style, and we can insert extensions using the putExtra method. In addition, we can define complements with the keyword + for the key/value pair.

val intent = intentOf {
putExtra(posterId, poster.id) // defines a value of the type posterId long.
putExtra(posterName to poster.name) // sets a value of the posterName type.
putExtra(poster, poster) // define a value of the poster type.

+(id to userInfo.id) // Set id of type Long.
+(name to userInfo.nickname) // Sets the value of the string of type name.

-Name // delete the value of the name string.

Start of activity

We can start using the expression intentionOf as shown below.

intentionOf {
putExtra(id to userInfo.id)
putExtra(name to userInfo.nickname)
putExtra(poster, poster)
startActivity([protected by email])

We can also use other options to create intentions.

intentionOf {
startActivity([protected via e-mail])

Bundling offer

a bar is an expression for initializing lazy values on purpose.

Second class of activity: AppCompatActivity() {

a private I.D: Long by bundle(id, -1) // initializes the extra value of lazy lung.
Private name of the valley : String by bundle (name, ) // lazily initializes the extra value of the string. Poster
of the private valley: Poster ? in a package (poster) // lazily initiates a package with extra costs.

// Roots.

We can initialize the Parcelable value with the default value.

Val’s private poster: Poster ? by bundle(poster) { Poster.create() }

We can also initialize the type Array and ArrayList with the expressions bundleArray and bundleArrayList.

// Initialize Lazy without default values. privatedalpostersAggau(posterArray)privatedalpostersArrayList(posterArrayList) array


// Initializes Lazy with default values.
private fall posterArray by bundleArray(posterArray) { arrayOf() }.
private val posterListArray by bundleArrayList(posterArrayList) { arrayListOf() }.


The following example shows how arguments can be defined with the expression intOf.

arguments = intentOf {
+(id to userInfo.id)
+(name to userInfo.nickname)
+(poster to poster)

We can lazily initialize the fragmentary argument values using a packet expression as shown below.

– Valid: Lang = ?.getLong(id, -1) ? : –
+ fall id : Long on a packet (id, -1)
– Rough display : A poster? = arguments ?.getParcelable(poster)
+ poster trap : A poster? A tutu.


intent android,intent common,bundle in android studio example,pending intent in android,intent in android hindi,allowing other apps to start your activity,common intents,intent-filter priority,broadcast receiver in android,kotlin bundleof,get bundle in fragment kotlin,bundleof kotlin not found,ignoredonparcel,android studio bundle,kotlin set arguments,kotlin activity example,kotlin get activity from fragment,oncreate' overrides nothing kotlin,kotlin multiple activity,android start a new activity kotlin,android activity factory,realm-android,realm vs room,realm update object android,realm database example in kotlin,realm tutorial,plugin with id 'realm-android' not found.,android bundle parcelable,android intent pass object,how to pass integer value in bundle android,android pass object to activity parcelable,android intent putextra,put serializable object in intent android kotlin,android pass serializable object between activities,android pass object reference to activity

You May Also Like

Excel VBA: If Cell Contains Value Then

In this article we will see how to automate the beginning of…

Paypal integration in PHP Application

Last updated on the 28th. August 2020 at 5:14 p.m. In this…

Remove SearchMarquis.com redirect virus from Mac

Among the security threats Mac users should be concerned about, browser hackers…

9 Actionable Tips to Fix Smart Lock and Trusted Places on Android

People love that their work can be done easily and without problems.…