Caller's Intent and Recipient's Intent

Upon testing, doing

// MainActivity.kt
val intent = CheatActivity.newIntent( ... )
Log.d(TAG, "${intent.hashCode}")
startActivityForResult(intent, REQUEST_CODE_CHEAT)

// CheatActivity.kt
override fun onCreate( ... ) {
  super.onCreate(savedInstanceState)
  Log.d(TAG, "${intent.hashCode}")
}

Prints two different hash codes.

2019-10-12 07:21:33.693 2574-2574/geoquizbnr4kv2 D/GeoQuiz4K.MainActivity: Intent: 15809291
2019-10-12 07:21:33.816 2574-2574/geoquizbnr4kv2 D/GeoQuiz4K.CheatActivity: Intent: 83885626

so either the ActivityManager is manipulating the object and they are the same OR the ActivityManager creates a copy.

Either way, any extras put on the intent will remain the same.

1 Like