Tell me, how many times have you used the following code to start an Activity?
Intent intent = new Intent(CurrentActivity.this, NextActivity.class); intent.putExtra("key", value); //Optional parameters CurrentActivity.this.startActivity(intent);
Countless times, isn't it? And we know it's boring. But now with the help of Anko, we can start activity very easily. Anko's Intents.kt has a few extension functions using which we can start the activity. Take a look at the code in AppToolbar.kt, on clicking the menu we are starting ProfileActivity:
toolbar.context.startActivity<ProfileActivity>()
The code looks so much cleaner with no verbosity. But starting an activity is not always that simple. We also sometimes ...