January 2018
Intermediate to advanced
434 pages
14h 1m
English
If you look at the implementation, you will find that Anko has provided just a syntactic sugar that greatly reduces your lines of code to achieve a similar thing:
fun Context.share(text: String, subject: String = ""): Boolean { try { val intent = Intent(android.content.Intent.ACTION_SEND) intent.type = "text/plain" intent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject) intent.putExtra(android.content.Intent.EXTRA_TEXT, text) startActivity(Intent.createChooser(intent, null)) return true } catch (e: ActivityNotFoundException) { e.printStackTrace() return false }}
As you can see, the library has taken care of all the issues that might crop up and just provided a helper function to make things faster and more fun.
Read now
Unlock full access